nginx
The way nginx implements static compression is actually like apache gzip compression. This kind of compression is a common thing for us. Let me introduce some methods below.
When building squid web page acceleration, large css or js should be compressed and then cached, which can reduce the download volume and improve the page response speed. If you are using a version earlier than squid 3.0 and using ngnix server, you may encounter the following problems: If you open the page directly without squid, the client will return a compressed state. If you enable squid acceleration, you will find that the downloaded page is not compressed state. This is mainly caused by not starting the static caching module (ngx_http_gzip_static_module) of ngnix.
Open the static cache problem is solved
nginx compile options
1 |
./configure –with-http_gzip_static_module |
configure nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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; #Cannot find the pre-compressed file, perform 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 public configuration gzip_http_version 1.1 gzip_proxied expired no-cache no-store private auth; |
gzip_vary on Description
For requests that support gzip, the reverse proxy cache server will return gzip content, and clients that do not support gzip will return the original content.
other instructions
- gzip_static configuration priority is higher than gzip
- After enabling nginx_static, for any file, it will first check whether there is a corresponding gz file
- gzip_types setting has no effect on gzip_static