我可以问一下你的出口,看看这个nginx反向代理和静态资产服务器的Rails 3.1后端预编译资产? 我本来希望所有的文件都能够被压缩,但是没有一个是通过这种方式来的。
nginx.conf:
worker_processes 1; events { worker_connections 1024; } http { include mime.types; keepalive_timeout 65; include /usr/local/nginx/conf/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; } }
我在你的configuration中看到缺lessgzip_proxied ,这不会帮助你的情况。 对于静态资产我看不出什么问题。 我的猜测是你的MIMEtypes不是正确的(一个请求的tcpflow将是很好的检查)。 还要注意:gzip PNG / JPG和其他压缩图像格式通常是毫无意义的; 没有足够的备用熵来使其值得。