Apache2.2中压缩传输文档

在apache2.2中压缩传输文档有两种方式:一种是安装一个mod_gzip扩展模块;另一种是启用apache自带的mod_deflate模块。两个模块的安装都比较简单,自apache2.2后已很少用mod_gzip。因此,下面简单介绍下deflate在windows和linux中的安装及设置。

Windows:
在httpd.conf中
1、去除LoadModule deflate_module modules/mod_deflate.so前面的#号。
2、再增加:
   <IfModule deflate_module>
       DeflateCompressionLevel 9
       AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
       AddOutputFilter DEFLATE css js
   </IfModule>

Linux:
1、编译安装时,配置中增加--enable-deflate参数,启用deflate。如:
   #./configure --prefix=/usr/local/apache2 ... --enable-deflate
2、在httpd.conf中增加:
   <IfModule deflate_module>
       DeflateCompressionLevel 9
       AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
       AddOutputFilter DEFLATE css js
   </IfModule>

注: 其中DeflateCompressionLevel 9 为最高压缩级别。

 

 

 

 

 

你可能感兴趣的:(windows,linux,PHP,xml,css)