: This article mainly introduces the Nginx series (17th) nginx compression output configuration. if you are interested in the PHP Tutorial, please refer to it. 1. configuration file
Gzip on; gzip_min_length 1 k; gzip_buffers 1664 k; gzip_http_version 1.1; gzip_comp_level 6; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on;
II. related parameters
Gzip on;
// This command is used to enable or disable the gzip module (on/off)
Gzip_min_length 1 k;
// Sets the minimum number of page bytes that can be compressed. the number of page bytes is obtained from the content-length header of the header. The default value is 0, and most pages are compressed. We recommend that you set the size to 1 kb. smaller than 1 KB may increase the pressure.
Gzip_buffers 4 16 k;
// Set the system to obtain several units of cache for storing gzip compressed result data streams. 4 16 K indicates that the size of the original data is 4 times the size of the requested memory in 16 K.
Gzip_http_version 1.1;
// Identify the http protocol version (1.0/1.1)
Gzip_comp_level 2;
// Gzip compression ratio. the minimum compression ratio is the fastest, and the maximum compression ratio is 9, but the processing speed is the slowest (fast transmission but cpu consumption)
Gzip_types text/plain application/x-javascript text/css application/xml
// Match the mime type for compression. whether specified or not, the "text/html" type is always compressed.
Gzip_vary on;
// It is related to the http header and adds a vary header for the proxy server. some browsers support compression and some do not support compression, so avoid wasting and compressing unsupported ones, therefore, we can determine whether compression is required based on the HTTP header of the client.
The above introduces the Nginx series (17th) nginx compression output configuration, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.