Configuration file found: http.conf
Apache Open Compression
First, turn on the configuration, remove the # number in front of the code below
LoadModule Deflate_module modules/mod_deflate.so
LoadModule Headers_module modules/mod_headers.so
Second, add compression rules
<ifmodule deflate_module>
#必须的, like a switch, tells Apache to compress the content transferred to the browser
Setoutputfilter DEFLATE
#压缩级别, 1-9,9 is the highest
Deflatecompressionlevel 6
#不进行压缩的文件
Setenvifnocase request_uri \. (?: gif|jpe?g|png) $ no-gzip dont-vary #设置不对后缀gif, jpg,jpeg,png picture file compression
Setenvifnocase request_uri \. (?: Exe|t?gz|zip|bz2|sit|rar) $ no-gzip dont-vary #同上, is not set Exe,tgz,gz ... The files are compressed
Setenvifnocase request_uri \. (?:p df|mov|avi|mp3|mp4|rm) $ no-gzip dont-vary
#针对代理服务器的设置
<ifmodule headers_moudle>
Header Append vary user-agent
</IfModule>
</IfModule>
Apache opens Web cache
First, turn on the configuration, remove the # number in front of the code below
LoadModule Expires_module modules/mod_expires.so
Second, add the cache rule
<ifmodule expires_module>
Expiresactive on
ExpiresDefault "Access plus 1 month"
Expiresbytype text/html "Access plus 1 months"
Expiresbytype text/css "Access plus 1 months"
Expiresbytype image/gif "Access plus 1 months"
Expiresbytype image/jpeg "Access plus 1 months"
Expiresbytype image/jpg "Access plus 1 months"
Expiresbytype image/png "Access plus 1 months"
Expiresbytype Application/x-shockwave-flash "Access plus 1 months"
Expiresbytype application/x-javascript "Access plus 1 months"
Expiresbytype video/x-flv "Access plus 1 months"
</IfModule>
Windows Apache server opens compression and Web caching