软件环境:
Apache 1.3.29
ApacheModuleGzip.dll
一、安装
http://www.21php.com/download/
下载ApacheModuleGzip.dll.zip压缩软件包。解压缩到apache的modules目录下。
二、配置
1). 安装完毕以后把下列配置加入httpd.conf :
LoadModule gzip_module modules/ApacheModuleGzip.dll
#AddModule mod_gzip.c
<IfModule mod_gzip.c>
mod_gzip_on yes
mod_gzip_dechunk yes
mod_gzip_keep_workfiles No
#设置gzip的临时目录,请确认目录C:WINNTTemp是否正确
mod_gzip_temp_dir C:/WINNT/Temp
mod_gzip_minimum_file_size 1002
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 1000000
mod_gzip_item_include file .htm$
mod_gzip_item_include file .html$
mod_gzip_item_include mime text/.*
mod_gzip_item_include file .php$
mod_gzip_item_include mime "application/x-httpd-php.*"
mod_gzip_item_include mime httpd/unix-directory
mod_gzip_item_include handler cgi-script
mod_gzip_item_exclude file ".css$"
mod_gzip_item_exclude file ".js$"
</IfModule>
2). 查找LogFormat并且在后面添加下面一行(主意不要分行):
LogFormat "%h %l %u %t "%V %r" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." 21php_gzip
3). 查找CustomLog,把这行
CustomLog logs/aclearcase/" target="_blank" >ccess.log common
用#注释,并且在后面添加一行,结果如下:
#CustomLog logs/access.log common
CustomLog logs/gzip_21php.log 21php_gzip
4). 运行开始菜单=>程序=>Apache HTTP Server=>configure Apache Server=>Test Configuration
如果显示结果是Syntax OK 则语法没有问题,重新启动apache 。
5). 查看配置结果
浏览主页,然后查看apache的logs目录下的gzip_21php.log文件,可以看到如下结果:
127.0.0.1 - - [29/Mar/2004:10:51:49 +0800] "localhost GET / HTTP/1.1" 200 794 mod_gzip: OK In:1108 Out:794:29pct.
127.0.0.1 - - [29/Mar/2004:10:51:49 +0800] "localhost GET /apache_pb.gif HTTP/1.1" 200 2326 mod_gzip: DECLINED:EXCLUDED In:0 Out:0:0pct.
其中29pct表示压缩率为29%