gzip 压缩在 nginx 反向代理设置中不起作用

Oz *_*mon 5 nginx

我们在反向代理模式下的 Apache 服务器前面有 nginx。

我们最初让 Apache 使用 mod_deflate 压缩文件,但事实证明这会导致某些 Internet Explorer 实例出现问题。我的猜测是 nginx 对“不同”响应进行了一些奇怪的处理,它是触发 IE 问题的代理缓存。

我们现在尝试使用 nginx 本身压缩内容,因此我们禁用了 Apache 中的 mod_deflate,并将以下内容添加到 nginx 服务器{} 配置中

gzip             on;
gzip_proxied     any;
gzip_types       text/css text/plain text/xml application/xml application/javascript application/x-javascript text/javascript application/json text/x-json;
gzip_vary        on;
gzip_disable     "MSIE [1-6]\.";
Run Code Online (Sandbox Code Playgroud)

这没有效果。正如使用 Fiddler 验证的那样,内容总是在没有 gzip 压缩的情况下提供。

我尝试过的事情:

  1. 删除 gzip_vary 和 gzip_disable 选项(后者与本网站上的其他一些问题有关)。
  2. 移动 gzip
  3. 设置到服务器设置的位置部分。{} 在位置前后移动 gzip 设置{}

有没有人有这种设置工作?

操作系统:CentOS 2.6.18-274.17.1.el5,nginx 版本:1.0.12

Oz *_*mon 7

回答我自己的问题:问题似乎是“nginx reload”没有导致设置生效。发出完整的“nginx重启”修复了它。