使用 Apache mod_deflate模块
1.使用此模块
LoadModule deflate_module modules/mod_deflate.so
2.在conf文件底下加上
<ifmodule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/css #压缩类型 DeflateCompressionLevel 9 #将输出内容压缩的程度 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 </ifmodule>