Nginx开启Gzip压缩大幅提高页面加载速度

[root@12 conf]# vi nginx.conf

        gzip on;#开启GZIP
gzip_min_length 1k; #不压缩临界值,大于1K的才压缩,一般不用改
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;#压缩级别,1-10,数字越大压缩的越好,时间也越长
#gzip_types text/plain application/x-javascript text/css application/xml;
gzip_types text/plain application/x-javascript text/css application/xmli text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off;
gzip_disable "MSIZE [1-6]\.";#IE6对Gzip不怎么友好,不给它Gzip
service nginx reload
[root@12 conf]# curl -I -H "Accept-Encoding:gzip,deflate" "http://xinxianm.com"
HTTP/1.1 200 OK
Server: nginx/1.4.4
Date: Tue, 31 May 2016 01:01:45 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
X-Powered-By: PHP/5.5.7
Set-Cookie: ECS_ID=650aa6ce6b78e9803c78923affc6a98ad5cf9bd2; path=/
Cache-control: private
Content-Encoding: gzip
[root@12 conf]# curl -I -H "Accept-Encoding:gzip,deflate" "http://xinxianm.com/images/upload/Image/1_05%2875%29.jpg"
HTTP/1.1 200 OK
Server: nginx/1.4.4
Date: Tue, 31 May 2016 01:02:46 GMT
Content-Type: image/jpeg
Last-Modified: Tue, 12 Apr 2016 07:24:20 GMT
Connection: keep-alive
Expires: Thu, 30 Jun 2016 01:02:46 GMT
Cache-Control: max-age=2592000
Content-Encoding: gzip
上一篇:Nginx开启Gzip压缩


下一篇:nginx开启gzip压缩后导致apk包下载不能正常安装