ngx_http_gzip_module
The ngx_http_gzip_module module is a filter that uses the "gzip" method to compress responses. This usually helps to reduce the size of the transferred data by half or more
Instructions | Description |
---|---|
gzip | Define whether to enable the "gzip" compression function, which is not enabled by default; |
gzip_buffers | Define the number and size of the buffers used to compress the response, the default value: gzip_buffers 32 4k |
gzip_comp_level | Set the response gzip compression level, the compression level is between 1~9; the default value: gzip_comp_level 1 |
[
| gzip_min_length | Set a minimum length of response compression; compression is performed if it is larger than this number; default: gzip_min_length 20 |
| gzip_http_version | Define HTTP protocol version for compression, default http_version 1.1 |
| gzip_proxied | Enable Nginx as a proxy server, set parameters |
| gzip_types | Define the MIME type of the compressed response content; default: gzip_types text/html |
| gzip_vary | Define whether to insert "Vary: Accept-Encoding" response information in the response header of the sending client, which is used by the client browser to identify whether the content has been compressed; default: gzip_vary off |
General configuration
Add to
vhost
conf
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types image/svg+xml text/plain text/html text/xml text/css text/javascript application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript application/x-font-ttf application /vnd.ms-fontobject font/opentype font/ttf font/eot font/otf;
Post comment 取消回复