mod_deflate模块

(1)作用

 使用mod_deflate模块压缩页面优化传输速度
 适用场景:
(1) 节约带宽,额外消耗CPU;同时,可能有些较老浏览器不支持
(2) 压缩适于压缩的资源,例如文本文件

LoadModule deflate_module modules/mod_deflate.so
SetOutputFilter DEFLATE
\# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css

 # Level of compression (Highest 9 - Lowest 1)
 DeflateCompressionLevel 9
 排除特定旧版本的浏览器,不支持压缩
Netscape 4.x 只压缩text/html
BrowserMatch ^Mozilla/4 gzip-only-text/html
Netscape 4.06-08三个版本 不压缩
BrowserMatch ^Mozilla/4.0[678] no-gzip
Internet Explorer标识本身为“Mozilla / 4”,但实际上是能够处理请求的压缩。如果用户代理首部匹配字符串“MSIE”(“B”为单词边界”),就关闭之前定义的限制
BrowserMatch \bMSI[E] !no-gzip !gzip-onlytext/html

你可能感兴趣的:(mod_deflate模块)