wlyyb521 发表于 2018-11-9 06:21:38

nginx 配置 gzip压缩

一般情况下压缩后的html、css、js、php、jhtml等文件,大小能降至原来的25%,也就是说,原本一个100k的html,压缩后只剩下25k。这无疑能节省很多带宽,也能降低服务器的负载。  在nginx中配置gzip比较简单
  具体可见http://wiki.codemongers.com/NginxChsHttpGzipModule
  一般情况下只要在nginx.conf的http段中加入下面几行配置即可
  引用
  gzipon;
  gzip_min_length1000;
  gzip_buffers   4 8k;
  gzip_types       text/plain application/x-javascript text/css text/html application/xml;
  重启nginx
  可以通过网页gzip检测工具来检测网页是否启用了gzip

页: [1]
查看完整版本: nginx 配置 gzip压缩