Apache2.x中设置gzip

原文出处:  Apache2.x中设置gzip
作者: Jet Mah from  Java堂
声明:  可以非商业性任意转载, 转载时请务必以超链接形式标明文章原始出处、作者信息及此声明!

在Apache2.x中使用mod_deflate进行gzip压缩,配置信息如下:

 

  1. LoadModule deflate_module modules/mod_deflate.so
  2. LoadModule headers_module modules/mod_headers.so
  3.  
  4. # gzip 设置
  5. # Only compress specified content type
  6. # see also http://www.devside.net/guides/config/compression
  7. <IfModule mod_deflate.c>
  8.     # The value must between 1 (less compression) and 9 (more compression)
  9.     DeflateCompressionLevel 7
  10.     # compress content with type html, text, and css
  11.     AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php application/json
  12.     # place filter 'DEFLATE' on all outgoing content
  13.     SetOutputFilter DEFLATE
  14.     # Properly handle old browsers that do not support compression
  15.     BrowserMatch ^Mozilla/4 gzip-only-text/html
  16.     BrowserMatch ^Mozilla/4\.0[678] no-gzip
  17.     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  18. </IfModule>

 

参考资料:
apache 2.2.15中配置mod_deflate
httpd.conf — compression

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值