[文章作者:张宴 本文版本:v1.0 最后修改:2007.09.10 转载请注明出处:http://blog.zyan.cc]
1、如果未安装Apache。编译时,加上--enable-deflate,例如:(仅针对Linux版,Windows版无须此步骤)
./configure --prefix=/usr/local/apache --enable-rewrite --enable-so --enable-deflate
2、如果已安装Apache。添加mod_deflate模块,例如:(仅针对Linux版,Windows版无须此步骤)
/usr/local/apache/bin/apxs -i -a -c /home/zhangyan/software/httpd-2.0.59/modules/filters/mod_deflate.c
注:/home/zhangyan/software/httpd-2.0.59/为Apache源码路径。
3、进行以上步骤后,会在httpd.conf中自动加入一行:(Windows版请将下行最前面的#号去掉)
4、编辑httpd.conf,增加:
Linux版:
Windows版:
如果将#号去掉,可以在logs/deflate_log.log日志文件中看到文件压缩前后的字节数、压缩比,例如:
"GET /index.html HTTP/1.1" 49373/276249 (17%)
压缩前的字节数为276249,压缩后的字节数为49373,压缩比为17%
5、详细配置见Apache官方网站:http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
1、如果未安装Apache。编译时,加上--enable-deflate,例如:(仅针对Linux版,Windows版无须此步骤)
./configure --prefix=/usr/local/apache --enable-rewrite --enable-so --enable-deflate
2、如果已安装Apache。添加mod_deflate模块,例如:(仅针对Linux版,Windows版无须此步骤)
/usr/local/apache/bin/apxs -i -a -c /home/zhangyan/software/httpd-2.0.59/modules/filters/mod_deflate.c
注:/home/zhangyan/software/httpd-2.0.59/为Apache源码路径。
3、进行以上步骤后,会在httpd.conf中自动加入一行:(Windows版请将下行最前面的#号去掉)
引用
LoadModule deflate_module modules/mod_deflate.so
4、编辑httpd.conf,增加:
Linux版:
引用
<ifmodule mod_deflate.c>
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>
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>
Windows版:
引用
<ifmodule deflate_module>
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>
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>
如果将#号去掉,可以在logs/deflate_log.log日志文件中看到文件压缩前后的字节数、压缩比,例如:
"GET /index.html HTTP/1.1" 49373/276249 (17%)
压缩前的字节数为276249,压缩后的字节数为49373,压缩比为17%
5、详细配置见Apache官方网站:http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
shz
2022-7-29 15:56
I think about it is most required for making more on this get engaged Lead generation
shz
2022-7-29 15:59
very interesting post.this is my first time visit here.i found so many interesting stuff in your blog especially its discussion..thanks for the post! Lead generation
shz
2022-7-29 16:04
You completely match our expectation and the variety of our information. Lead generation
shz
2022-7-29 16:08
Wonderful blog post. This is absolute magic from you! I have never seen a more wonderful post than this one. You've really made my day today with this. I hope you keep this up! Lead generation
shzz
2022-8-22 22:59
There's no doubt i would fully rate it after i read what is the idea about this article. You did a nice job.. Asea
shz
2022-8-22 23:01
I was taking a gander at some of your posts on this site and I consider this site is truly informational! Keep setting up.. Rache Rofe
shzz
2022-8-22 23:05
You completely match our expectation and the variety of our information. Digital Storefronts
shz
2022-8-22 23:06
A great website with interesting and unique material what else would you need. Rache Rofe
shzz
2022-8-22 23:08
This is an awesome motivating article.I am practically satisfied with your great work.You put truly extremely supportive data. Keep it up. Continue blogging. Hoping to perusing your next post Digital Storefronts
shz
2022-8-22 23:12
Thank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me. Zen Arbitrage
shzz
2022-8-22 23:15
I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the best of luck for all your blogging efforts. Zen Arbitrage
shz
2022-8-22 23:16
Its as if you had a great grasp on the subject matter, but you forgot to include your readers. Perhaps you should think about this from more than one angle. Zen Arbitrage
Lucky cola
2024-2-7 13:47
Join the gaming revolution - are you game? Lucky cola
分页: 3/3 1 2 3