When constructing squid web page acceleration, compress large css or js files and then cache them. This increases the page response speed by reducing the download volume. If you are using a version earlier than squid 3.0 and use an ngnix server, you may encounter the following problems: if you do not need squid to open the page directly, the client returns the compressed state, if squid acceleration is enabled, the downloaded page is not in the compressed state. This is mainly because the ngnix static cache module (ngx_http_gzip_static_module) is not started.
Solve the static cache problem.
1. nginx compilation options
The code is as follows: |
Copy code |
./Configure -- with-http_gzip_static_module
|
2. Modify nginx. conf
The code is as follows: |
Copy code |
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; # Pre-compressed files cannot be found for dynamic compression Gzip on; Gzip_min_length 1000; Gzip_buffers 4 16 k; 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; |
For requests that support gzip, the reverse proxy cache server will return gzip content. Clients that do not support gzip will return the original content.
Gzip_vary on;
1.gzip _ static configuration has a higher priority than gzip
2. After nginx_static is enabled, you will first check whether a corresponding gz file exists for any file.
3.gzip _ types settings are invalid for gzip_static