#####################
#
# debian方式安装
#
#####################
# a2enmod defalte
# a2enmod headers
# vim /etc/apache2/sites-available
AddOutputFilterByType DEFLATE text/html text/plain text/css
DeflateCompressionLevel 7
SetOutputFilter DEFLATE
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log.log deflate
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI /
\.(?:gif|jpe?g|png|exe|bmp|mp3|rar|zip|swf|cab|t?gz|bz2|sit)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
# /etc/init.d/apache2 reload
#####################
#
# 源码方式安装
#
#####################
# {apache-bin}/apxs -i -a -c {apache-src}/modules/filters/mod_deflate.c
# {apache-bin}/apxs –i –a –c {apache-src}/modules/metadata/mod_headers.c
# 编辑http.conf 添加如下内容
LoadModule headers_module modules/mod_headers.so
LoadModule deflate_module modules/mod_deflate.so
# 编辑http.conf 添加mod_deflate内容
### 内容同上 ###
阅读(720) | 评论(0) | 转发(0) |