Gzip configuration parameters of Nginx
Gzip
Determine whether to enable the gzip module:
Param: on | off
Example: gzip on;
Gzip_buffers
Set the size of gzip applied memory. The function is to apply for memory space by a multiple of the block size.
Param1: int
Param2: the unit behind int (k) is k.
Example: gzip_buffers 4 8 k;
Gzip_comp_level
Set the gzip compression level. The lower the level, the faster the compression speed, the smaller the file compression ratio. The slower the speed, the larger the file compression ratio.
Param: 1-9
Example: gzip_com_level 1;
Gzip_min_length
When the returned content is greater than this value, gzip is used for compression. The unit is K. When the value is 0, all pages are compressed.
Param: int
Example: gzip_min_length 1000;
Gzip_http_version
Used to identify the http protocol version. Earlier browsers do not support gzip compression, and garbled characters are displayed. To support earlier versions, this option is added. Currently, this option can be ignored.
Partam: 1.0 | 1.1
Example: gzip_http_version 1.0
Gzip_proxied
Enable Nginx as the reverse proxy. param: off | expired | no-cache | no-sotre | private | no_last_modified | no_etag | auth | any]
Expample: gzip_proxied no-cache;
Off-disable data compression for all proxy results
Expired-enable compression. If The header contains "Expires" header information
No-cache-enable compression. If The header contains the "Cache-Control: no-cache" header
No-store-enable compression. If The header contains the "Cache-Control: no-store" header
Private-enable compression. If The header contains "Cache-Control: private" header information
No_last_modified-enable compression. If The header contains "Last_Modified" header information
No_etag-enable compression. If The header contains "ETag" header information
Auth-enable compression. If The header contains "Authorization" header information
Any-unconditionally compress all result data
Gzip_types
Sets the MIME type to be compressed. Non-set values are not compressed.
Param: text/html | application/x-javascript | text/css | application/xml
Example: gzip_types text/html;
Nginx gzip configuration parameters
Example:
The code is as follows: |
Copy code |
Gzip on; Gzip_min_length 1000; Gzip_buffers 4 8 k; Gzip_types text/html application/x-javascript text/css application/xml; |