一、安装
http://www.hyperspacecommunications.com/products/mod_gzip.html
页面上有 mod_gzip 的二进制码版本和源码下载。如果你使用前者的话,直接把文件拷贝到 Apache Home 的 libexec 目录下就可以了。下载 mod_gzip.c 后,如果你的 Apache 用 DSO 模式安装的话,用下面简单的命令就可以安装了:# /www/bin/apxs -i -a -c mod_gzip.c
二、配置
安装完毕以后把下列配置加入 httpd.conf :
# mod_gzip 配置
LoadModule gzip_module libexec/mod_gzip.so
AddModule mod_gzip.c
mod_gzip_on Yes
mod_gzip_minimum_file_size 1002
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 60000
mod_gzip_item_include mime "application/x-httpd-php"
mod_gzip_item_include mime "text/*"
# 压缩 Zope 的内容:
mod_gzip_item_include file "[^.]*$"
mod_gzip_item_include mime "httpd/unix-directory"
mod_gzip_dechunk Yes
mod_gzip_temp_dir "/tmp"
mod_gzip_keep_workfiles No
mod_gzip_item_include file "\.php$"
mod_gzip_item_include file "\.txt$"
mod_gzip_item_include file "\.html$"
mod_gzip_item_exclude file "\.css$"
mod_gzip_item_exclude file "\.js$"
并添加下面的行:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" mod_gzip: %{mod_gzip_compression_ratio}npct." mod_gzip
把对应虚拟主机配置中的日志文件参数修改为 mod_gzip
三、压缩效果
这样,我们得到类似以下的日志文件:
61.169.41.13 - - [02/Mar/2002:01:24:29 -0500] "GET /pipermail/freelamp/2002-March/000026.html HTTP/1.1" 200 72848 "http://www.freelamp.com/pipermail/freelamp/2002-March/subject.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 54pct.
61.169.41.13 - - [02/Mar/2002:01:24:52 -0500] "GET /new/publish/1003233602/index_html HTTP/1.1" 200 4304 "http://www.freelamp.com/new/publish/search?subject=Zope&op=articles" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 65pct.
61.169.41.13 - - [02/Mar/2002:01:24:53 -0500] "GET /new/publish/global_css HTTP/1.1" 200 629 "http://www.freelamp.com/new/publish/1003233602/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 73pct.
61.169.41.13 - - [02/Mar/2002:01:24:54 -0500] "GET /new/publish/Images/sitetitle_img HTTP/1.1" 304 0 "http://www.freelamp.com/new/publish/1003233602/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 0pct.
61.169.41.13 - - [02/Mar/2002:01:26:21 -0500] "GET /new/publish/index_html HTTP/1.1" 200 7317 "http://www.freelamp.com/new/publish/1003233602/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 80pct.
61.169.41.13 - - [02/Mar/2002:01:26:22 -0500] "GET /new/publish/global_css HTTP/1.1" 200 629 "http://www.freelamp.com/new/publish/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 73pct.
61.169.41.13 - - [02/Mar/2002:01:26:24 -0500] "GET /new/publish/TopicImages/Tutorial HTTP/1.1" 304 0 "http://www.freelamp.com/new/publish/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 0pct.
61.169.41.13 - - [02/Mar/2002:01:26:24 -0500] "GET /new/publish/LinkImages/jsp001_img HTTP/1.1" 304 0 "http://www.freelamp.com/new/publish/index_html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; NetCaptor 6.5.0)" mod_gzip: 0pct.
我们看到 mod_gzip 已经对 .html 和那些没有点的文件作了压缩,压缩率达到了 70-80%。但是,mod_gzip 对图片文件不作压缩。
四、总结
结合,mod_gzip 和缓冲工具等,我们完全可以使一台配置较低的 PC 有足够的能力处理各种 HTML/CGI 等的请求。
|
|||
| · Exchange Server专题 · 软件插件 · Serv-U基础应用专题 · 负载均衡技术基础专题 · CRM项目实施指导 · ERP系统应用实施指导 · Windows服务器全面加固 · Windows发展史 |
· Cisco IOS · Windows注册表应用指南 · FreeBSD使用教程 · Windows活动目录服务应.. · Windows系统使用技巧 · Zope应用开发指南 · MySQL基础与配置 · Windows Server 2008 .. |
||
|
|||
| · Java基础教程 · VPN技术 · SQL Server 2005全解 · ARP攻击防范与解决方案 · SOA 面向服务架构 · SQL Server 2005全解 · Java编程开发手册 · 三层交换技术专题 |
· SQL Server入门到精通 · Windows Server 2003企.. · Windows远程桌面应用 · C#技术开发指南 · VPN技术 · Solaris 10 配置管理 · C#技术开发指南 · Windows操作系统安装 |
||
|
|||
| · VPN技术 · ARP攻击防范与解决方案 · SQL Server 2005全解 · Java基础教程 · SQL Server入门到精通 · SQL Server 2005全解 · SOA 面向服务架构 · Java编程开发手册 |
· C#技术开发指南 · 三层交换技术专题 · C#技术开发指南 · Windows远程桌面应用 · Windows Server 2003企.. · 邮件服务器专题 · wimax技术与趋势 · Windows操作系统安装 |
||
| ·DB2 Viper快速入门 ·DB2 9数据库的镜像分割与.. |
·将XML应用程序从DB2 8.x.. ·DB2 9中的pureXML:如何.. |
| ·服务器中的“傻瓜机”在.. ·盖茨也喜欢登录Youtube看.. |
· · |
| ·9月第3周回顾:微软和英.. ·9月第2周回顾:四核之战.. |
·9月第1周回顾:微软国际.. ·什么样的文章更容易被编.. |
| ·RedHat AS 4.0 DNS服务器.. ·Active Directory中的访.. |
·利用CSVDE命令实现域用户.. ·重磅新书——《网管员必.. |
| · NGN:下一代网络 · 网络访问中断大排查 · FTTx光纤接入 |
· 平凡黑客讲述精彩人生(.. · 平凡黑客讲述精彩人生(.. · 平凡黑客讲述精彩人生(.. |
| · C++是垃圾语言?! · 2007年IT界七大抄袭事件 · Java实用开发全集 |
· 解析Ajax开发框架 走进A.. · 基于Google Maps与Ajax.. · 基于Google Maps与Ajax.. |
| · Ubuntu 中文开源频道 · Solaris基础知识入门 · 微软正式发布英文版Wind.. |
· 服务器基础知识入门 · Rambus第二?看全缓冲内.. · 服务器节能对比测试:AM.. |
| · 甲骨文Oracle 11g正式发.. · Oracle数据库开发之PL/S.. · Oracle数据库开发基础教.. |
· 存储2006,一个并购的大.. · IDC宣布浪潮蝉联存储市.. · 双机热备技术 |