是的,我知道还有很多其他问题看起来完全一样。 我想我一定都看过了。 两次。 在绝望中,我添加另一个以防我的具体configuration是问题。 忍受着我。
首先,问题:我需要做些什么来获得gzip压缩的工作?
我安装了运行nginx 1.1.19的Ubuntu 12.04服务器。 Nginx安装了以下软件包:
nginx nginx-common nginx-full
我的nginx.conf的http块如下所示:
http { include /etc/nginx/mime.types; access_log /var/log/nginx/access.log; sendfile on; keepalive_timeout 65; tcp_nodelay on; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
PageSpeed和YSlow都报告说我需要启用压缩。 我可以看到请求标头指示了Accept-Encoding:gzip,deflate,sdch ,但是响应头没有必然的Content-Encoding标头。
我已经尝试了各种其他configuration值( gzip_vary on , gzip_http_version 1.0等),但没有喜悦。
据我所知,我只能假设nginx是用压缩支持编译的,但是如果有什么办法可以validation的话,我很想知道。
如果有人看到我失踪的东西或可以build议进一步的debugging,请让我知道。 我不是系统pipe理员,我是Nginx的新手,所以我已经耗尽了所有我能想到或已经阅读的内容。
谢谢。
如果nginx不抱怨gzip on; 在您的configuration文件中,然后使用gzip模块进行编译。 默认情况下,它只压缩text / html的响应。 你需要configurationgzip_types,如果你想压缩其他任何东西(css,js等)。