免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1394 | 回复: 1
打印 上一主题 下一主题

[Web] 求助 apache2 关于deflate(网页压缩传输)的完全解决方案 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-07 15:21 |只看该作者 |倒序浏览
安装好apache2后,
发现httpd.conf里有load 模块mod_deflate.so,这应该说明安装时已经enable了deflate吧。

然后在httpd.conf里面加入了
-----------------------------------------------------------------------------
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml
------------------------------------------------------------------------------
然后重启apache

测试,打开速度跟原来差不多,汗~

忽然意识到,没有办法知道网页是否经过压缩,也就是说,没有办法知道deflate是否起作用了啊。

求助~

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
2 [报告]
发表于 2005-12-08 09:39 |只看该作者
  1. LoadModule deflate_module modules/mod_deflate.so
  2. LoadModule headers_module modules/mod_headers.so
  3. #Method 1: Only compress specified content type
  4. <Location />
  5.   <IfModule mod_deflate.c>
  6.     # compress content with type html, text, and css
  7.     AddOutputFilterByType DEFLATE text/html text/plain text/css
  8.     <IfModule mod_headers.c>
  9.       # properly handle requests coming from behind proxies
  10.       Header append Vary User-Agent
  11.     </IfModule>
  12.   </IfModule>
  13. </Location>

  14. # Method 2: Compress all content, manually excluding specified file types
  15. <IfModule mod_deflate.c>
  16.   # place filter 'DEFLATE' on all outgoing content
  17.   SetOutputFilter DEFLATE
  18.   # exclude uncompressible content via file type
  19.   SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|rar|zip)$ no-gzip
  20.   <IfModule mod_headers.c>
  21.     # properly handle requests coming from behind proxies
  22.     Header append Vary User-Agent
  23.   </IfModule>
  24. </IfModule>

  25. # deflate.log, log compression ratio on each request
  26. <IfModule mod_deflate.c>
  27.   DeflateFilterNote Input instream
  28.   DeflateFilterNote Output outstream
  29.   DeflateFilterNote Ratio ratio
  30.   LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
  31.   CustomLog logs/deflate.log deflate
  32. </IfModule>

  33. # Properly handle old browsers that do not support compression
  34. <IfModule mod_deflate.c>
  35.   BrowserMatch ^Mozilla/4 gzip-only-text/html
  36.   BrowserMatch ^Mozilla/4\.0[678] no-gzip
  37.   BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  38. </IfModule>
  39. </IfDefine>
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP