gzip + backend (thin + rails) not working

Krešimir Bojčić Kresimir.Bojcic at adacta.hr
Mon Dec 20 13:06:12 MSK 2010


I am trying to use gzip on the fly to compress my .js and .css files that are normally cached.

Backend server is thin (rails cluster). I've read all that I could find online - and I am currently hitting the wall.

 

I am checking my page via http://www.gidnetwork.com/tools/gzip-test.php and SpeedPage firefox plugin.

I've tried so far:

 

clear cache

put gzip on command in various places (http, server, location)

I've been playing with "Accept-Encoding   '' "

 

 

This is my config

 

 

user root;

worker_processes  2;

 
  

  

 
error_log  logs/error.log;

  

 
pid        logs/nginx.pid;

  

 
  

events {

 
    worker_connections  1024;

}

 
  

  

 
  

http {

 
    include       mime.types;

    default_type  application/octet-stream;

 
  

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

 
                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

 
  

    access_log  logs/access.log  main;

 
    sendfile        on;

    keepalive_timeout  65;

 
    tcp_nodelay off;

    tcp_nopush on;

 
    gzip  on;

    gzip_vary on;

 
    gzip_comp_level 2;

    gzip_proxied any;

 
    gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

  

 
    upstream gosjar_zagreb_cluster {

    server 127.0.0.1:4000;

 
    server 127.0.0.1:4001;

    server 127.0.0.1:4002;

 
    }

  

 
  

 
 
  

    }

 
  

    server {

 
        listen   80;

        server_name  zagreb-test.12ip.net;

 
        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

 
        proxy_set_header Host $http_host;

        proxy_set_header Proxy-Connection "";

 
        proxy_redirect off;

  

 
    location / {

        if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {

 
            expires max;

            break;

 
        }

        proxy_pass http://zagreb_test_cluster;

 
    }

  

 
  

    }

 
  

    server {

 
        listen   80;

        server_name  kostrena.12ip.net;

 
        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

 
        proxy_set_header Host $http_host;

        proxy_set_header Proxy-Connection "";

 
        proxy_redirect off;

  

 
    location / {

        if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {

 
            expires max;

            break;

 
        }

            proxy_pass http://gosjar_kostrena_cluster;

 
    }

    }

 
  

    server {

 
        listen   80;

        server_name  lovica123.12ip.net;

 
        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

 
        proxy_set_header Host $http_host;

        proxy_set_header Proxy-Connection "";

 
        proxy_redirect off;

  

 
    location / {

        if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {

 
            expires max;

            break;

 
        }

            proxy_pass http://lovica_cluster;

 
    }

    }

 
  

    server {

 
        listen   81;

        server_name  192.168.62.2;

 
        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

 
        proxy_set_header Host $http_host;

        proxy_set_header Proxy-Connection "";

 
        proxy_redirect off;

  

 
  

    location / {

 
        if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {

            expires max;

 
            break;

        }

 
        proxy_pass http://lovica_cluster;

    }

 
    }

  }

 

 

 

 

 

Krešimir Bojčić
Voditelj odjela vertikalnih rješenja

mobile: +385 91 4007 072
___________________________________________________

ADACTA d.o.o.
Prve Pile 1, 10000 Zagreb, Croatia

T: +385 1 550 80 35  F: +385 1 611 60 11
mailto: info at adacta.hr <mailto:info at adacta.hr>   URL: http://www.adacta.hr <http://www.adacta.hr/> 

Consider IT done.
___________________________________________________

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101220/164989b6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 6064 bytes
Desc: image001.jpg
URL: <http://nginx.org/pipermail/nginx/attachments/20101220/164989b6/attachment-0001.jpe>


More information about the nginx mailing list