Nginx开启gzip

Uiaoin 2021-12-05 122

Nginx HttpGzip模块常用配置:

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied   expired no-cache no-store private auth;
gzip_disable   "MSIE [1-6]\.";

注意:

  • gzip_min_length 建议设置值,不配置默认是0,即任何数据都会压缩,反而降低效率;

 

参考文档:

https://www.nginx.cn/doc/standard/httpgzip.html

https://www.cnblogs.com/kevingrace/p/10018914.html

加载更多