Nginx how to configure gzip compression

  

gzip compression is the http_gzip_module module. This module supports online real-time compression output data stream, use examples:
gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; Gzip_types text/plain application/x-javascript
text/css text/html application/xml;

gzip on| Off Turns the gzip module gzip_min_length 1000 on or off to set the minimum number of bytes allowed for the compressed page. The number of page bytes is obtained from the Content-Length in the header header. The default value is 0, regardless of how large the page is compressed. It is recommended to set the number of bytes larger than 1k. If it is less than 1k, the pressure will increase. That is: gzip_min_length 1024gzip_proxied expired no-cache no-store private auth; when Nginx is enabled as a reverse proxy, the result returned by the backend server is turned on or off. The prerequisite is that the backend server must return the header containing "Via"; head. Gzip_types text/plain application/xml; matches MIME types for compression, (whether or not specified) ”text/html” types are always compressed.

Copyright © Windows knowledge All Rights Reserved