小编Jer*_*rry的帖子

使用 nginx 进行 Gzip 压缩

在我的 nginx.conf 中,我有:

gzip              on;
gzip_static       on;
gzip_buffers      16 8k;
gzip_comp_level   9;
gzip_http_version 1.0;
gzip_min_length   1000;
gzip_types        text/plain text/css image/x-icon image/bmp image/png image/gif image/jpeg image/jpg application/json application/x-javascript text/javascript;
gzip_vary         on;
gzip_proxied any;
Run Code Online (Sandbox Code Playgroud)

所以,如果我在我的服务器上获取图片的标题:

spiroo@glamdring:~$ curl -I http://static.mysite.com/g/pics/big_6e1855d844ebca560379139e75942f669655f.jpeg
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 04 Apr 2013 13:00:20 GMT
Content-Type: image/jpeg
Content-Length: 5336
Last-Modified: Mon, 25 Mar 2013 13:28:02 GMT
Expires: Fri, 04 Apr 2014 13:00:20 GMT
Cache-Control: max-age=31536000
Pragma: public
Cache-Control: public, must-revalidate, proxy-revalidate
Accept-Ranges: bytes
Run Code Online (Sandbox Code Playgroud)

但是如果我在 nginx.conf 中关闭 …

compression nginx gzip http-headers

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

compression ×1

gzip ×1

http-headers ×1

nginx ×1