Rob*_*son 3 linux ubuntu http nginx gzip
是的,我知道还有很多其他问题看起来与此完全一样。我想我一定看过所有这些。两次。绝望中,如果我的特定配置是问题,我将添加另一个。忍受我。
首先,问题:我需要做什么才能让 gzip 压缩工作?
我安装了一个运行 nginx 1.1.19 的 Ubuntu 12.04 服务器。Nginx 与以下软件包一起安装:
nginx
nginx-common
nginx-full
Run Code Online (Sandbox Code Playgroud)
http我的块nginx.conf看起来像这样:
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/*;
}
Run Code Online (Sandbox Code Playgroud)
PageSpeed 和 YSlow 都报告我需要启用压缩。我可以看到请求标头指示Accept-Encoding:gzip,deflate,sdch,但响应标头没有推论Content-Encoding标头。
我已经试过各种其他配置值(gzip_vary on,gzip_http_version 1.0,等),但没有喜悦。
据我所知,我只能假设 nginx 是通过压缩支持编译的,但是如果有任何方法可以验证这一点,我很想知道。
如果有人看到我遗漏的任何内容或可以建议进一步调试,请告诉我。我不是系统管理员,我是 Nginx 的新手,所以我已经用尽了我能想到或读过的所有内容。
谢谢。
如果 nginx 没有抱怨gzip on;在你的配置文件中,那么它是用 gzip 模块编译的。默认情况下,它只压缩 text/html 响应。如果要压缩其他任何内容(css、js 等),则需要配置gzip_types。
| 归档时间: |
|
| 查看次数: |
3957 次 |
| 最近记录: |