[[email protected] 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 [[email protected] 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
[[email protected] 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
时间: 2024-10-05 03:25:48