Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Could I ask once of you exports to look at this nginx reverse proxy and static asset server for a Rails 3.1 backend with precompiled assets? I would have expected all files to be served gzipped, but none of them are coming through that way.

nginx.conf:

worker_processes  1;                                                                                                                   

events {                                                                                                                               
        worker_connections  1024;                                                                                                      
}                                                                                                                                      

http {                                                                                                                                 
        include       mime.types;                                                                                                      

        keepalive_timeout  65;                                                                                                         

        include /usr/local/nginx/conf/sites-enabled/*;                                                                                 
}

sites-enabled/site.conf;

ssl_certificate /usr/local/nginx/conf/certs/site.com.crt;
ssl_certificate_key /usr/local/nginx/conf/certs/site.com.key;

server {
        listen 443 ssl;
        listen 80;
        server_name staging.site.com;

        gzip on;
        gzip_types  text/plain text/css application/x-javascript image/png image/jpeg; 

        location /assets {
                root /home/site/www/staging.site.com/current/public;
                expires 15d;
        }

        location / {
                proxy_pass http://127.0.0.1:1991;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_redirect off;
                proxy_set_header X-Forwarded-Proto https;
        }
}
share|improve this question

1 Answer 1

I see a lack of gzip_proxied in your config, which won't be helping your case. I don't see a particular problem with it for static assets; my guess is that your MIME types aren't coming out right (a tcpflow of a request would be nice to inspect). A note, too: it's usually pointless to gzip PNGs/JPGs and other compressed image formats; there isn't enough spare entropy in them to make it worthwhile.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.