Nginx implementation of static compression is actually like the Apache gzip compression, this compression is common to some of the things we have, the following I introduce some practices.
In the construction of Squid Web page acceleration, for large CSS or JS to be compressed, and then cache, this can improve the reduction of download volume to improve the speed of the page response. If you use the previous version of Squid 3.0 and use the Ngnix server, you may encounter the following problems: Do not use squid directly open the page, the client returned is the state of compression, if enabled squid acceleration will find that the downloaded page is not compressed state. This is mainly caused by a static cache module (Ngx_http_gzip_static_module) that does not start Ngnix.
Open the static cache problem to solve
1.nginx compilation options
./configure--with-http_gzip_static_module
2. Modify Nginx.conf
Gzip_static on;
Gzip_http_version 1.1;
Gzip_proxied expired No-cache no-store private auth;
Gzip_disable "MSIE [1-6]."
Gzip_vary on;
#找不到预压缩文件, dynamic compression
gzip on;
Gzip_min_length 1000;
Gzip_buffers 4 16k;
Gzip_comp_level 5;
Gzip_types text/plain application/x-javascript text/css application/xml;
#gzip公共配置
gzip_http_version 1.1
gzip_proxied expired No-cache no-store private auth;
For requests that support gzip, the reverse proxy cache server will return the gzip content, and the client that does not support gzip returns the original content.
Copy Code code as follows:
1.gzip_static configuration priority is higher than gzip
2. After opening the nginx_static, for any file will first find whether there is a corresponding GZ file
3.gzip_types setting is not valid for gzip_static