Dec 8

使用mod_gzip加速你的html页面 不指定

felix021 @ 2007-12-8 13:34 [IT » 网络] 评论(0) , 引用(0) , 阅读(3514) | Via 本站原创 | |
mod_gzip是一个可以加速html页面的程序,以apache的模块方式工作

修改apache的配置文件。
# cd /path/to/apache/conf
# cp httpd.conf httpd.conf.bak
用你喜欢的文本编辑程序,修改httpd.conf
要把下面两行去掉注释
loadmodule gzip_module libexec/mod_gzip.so
addmodule mod_gzip.c

然后在结尾添加如下配置:
# mod_gzip configuration
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/*
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 ".php3$"
mod_gzip_item_include file ".php$"
mod_gzip_item_include file ".txt$"
mod_gzip_item_include file ".html$"
mod_gzip_item_include file ".shtml$"
mod_gzip_item_exclude file ".css$"
mod_gzip_item_exclude file ".js$"

#更多想用gzip压缩的文件格式....

然后就可以启动了:
# /path/to/apache/bin/apachectl restart
如果发现有错误,根据提示重新修改httpd.conf。




欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]