Apache使用mod_deflate模块压缩页面优化传输速度

可以写为一行,也可以写多行,默认为gzip

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)默认为6

DeflateCompressionLevel 9

# Netscape 4.x has some problems.

BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems

BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine

BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

posted @ 2016-07-01 16:34  fansik  阅读(331)  评论(0编辑  收藏  举报