Nginx open Gzip compression to enhance the page loading speed

1. Create a new file in the gzip.conf nginx conf directory

# Open gzip compression 
gzip ON; 
# minimum number of bytes in a page arrangement allows the compressed 
gzip_min_length 1K; 
# 4 units application flow as a cache memory is 16K compression results 
gzip_buffers 16K. 4; 
# http protocol version identification is provided, the default is 1.1 
gzip_http_version 1.1; 
# specify gzip compression ratio, the smaller the number 1-9, the compression ratio of the smaller, faster 
gzip_comp_level 2; 
# specify the type of compression 
gzip_types text / plain application / javascript text / css application / xml text / javascript application / x PHP Image--httpd / jpeg Image / Image GIF / PNG; 
# make front-end cache server been to gzip compression pages 
gzip_vary oN; 
# IE6 not very friendly gzip, gzip do not give it a 
gzip_disable "MSIE [1-6] \. ";

 

2. Import gzip.conf to nginx.conf

{HTTP 
the include the mime.types; 
default_type file application / OCTET-Stream; 
# open efficient file transfer mode 
the sendfile ON; 
# Set client connection timeout conservation activities 
keepalive_timeout 65; 
# compressed configuration 
the include gizp.conf; 
# Site 
Server { 
} 
}

3. When you turn to see the effect through Webmaster Tools: http://seo.chinaz.com/www.zwqh.top/


Speed ​​access to the web page also becomes much faster, praise!

Guess you like

Origin www.cnblogs.com/zwqh/p/11608726.html