The current situation is as shown in the figure. The size does not change after turning on gzip. Solution
Supplement nginx.conf
gzip on; gzip_comp_level 6; gzip_min_length 10k; gzip_buffers 16 8k; gzip_proxied any; gzip_types text/plain application/javascript application/x-javascript application/json text/javascript text/xml
text/css;
某草草2017-05-16 17:19:20
ngnix
的gzip
There are two key values in the configuration:
gzip_min_length
: Minimum compression length
Only the compressed content exceeding this length will be compressed, otherwise it will be output directly
gzip_types
: Compressed content typesgzip_types
:压缩内容类型
只有列出来的内容类型才会被压缩,其他类型的内容不会被压缩,类型指的是MIME类型。
如需要压缩JS文件需配置gzip_types text/javascript
Only the listed content types will be compressed, other types of content will not be compressed, the type refers to the MIME type.
gzip_types text/javascript
🎜