Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


worker_processes  1;                                                                                                                   

events {                                                                                                                               
        worker_connections  1024;                                                                                                      

http {                                                                                                                                 
        include       mime.types;                                                                                                      

        keepalive_timeout  65;                                                                                                         

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


ssl_certificate /usr/local/nginx/conf/certs/;
ssl_certificate_key /usr/local/nginx/conf/certs/;

server {
        listen 443 ssl;
        listen 80;

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

        location /assets {
                root /home/site/www/;
                expires 15d;

        location / {
                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

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


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.