Apache的mod_deflate模块不COM preSS虽然日志文件说,它会 [英] Apache mod_deflate doesn't compress although logfile says it would

查看:171
本文介绍了Apache的mod_deflate模块不COM preSS虽然日志文件说,它会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图硬谷歌搜索这一点,但没有成功为止。
我有一个Apache 2.2.16在Debian与mod_deflate模块加载,这样启动:

I tried googling this by hard but was unsuccessful so far. I've got an apache 2.2.16 on Debian with mod_deflate loaded and enabled like this:

LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so

AddOutputFilterByType DEFLATE text/html text/css text/javascript application/x-javascript

DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%) "%{User-agent}i"' deflate
CustomLog /var/log/apache2/deflate_log deflate env=!trash

当我打开一个网页日志文件说,这是COM pressing我的CSS文件(及其他):

When I open a page the log file says that it's compressing my CSS file (and others):

"GET / HTTP/1.1" -/- (-%) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17"
"GET /www/js/dojoToolkit/dijit/themes/claro/claro.css HTTP/1.1" 17244/118618 (14%) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17"
"GET /www/css/basis-min.css HTTP/1.1" 10877/61154 (17%) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17"

但Firebug的,也Chrome浏览器执行仍然得到uncom pressed文件,虽然明确接受gzip和deflate编码。
一个有趣的事实也是在

But Firebug and also Chrome do still get the uncompressed files, although the explicitly accept gzip and deflate encoding. One interesting fact is also that the

Vary: Accept-Encoding

头仍设置,不像内容编码:

header is still set, unlike the Content-Encoding:

GET /www/js/dojoToolkit/dijit/themes/claro/claro.css HTTP/1.1
Host: www.getabstract.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,de-ch;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.getabstract.com/
Cookie: __utma=73758084.1377620539.1310985055.1310989511.1310990668.3; __utmz=73758084.1310985055.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fpc10001731534234=Y63gTWM9|aCXc2doLaa|fses10001731534234=|aCXc2doLaa|Y63gTWM9|fvis10001731534234=Zj1odHRwJTNBJTJGJTJGd3d3LmdldGFic3RyYWN0LmNvbSUyRiZiPUhvbWVwYWdlJTIwRU4=|8M8Y7oT7YH|8M8Y7oT7YH|8M8Y7oT7YH|8|8M8Y7oT7YH|8M8Y7oT7YH; __ar_v4=262MD4C3UNHKBELB3VUEGS%3A20110717%3A20%7CTBE3U4YYEBCGHJ2QAUBVE4%3A20110717%3A20%7CXVIJYAN7KFDQXPECC3AI7E%3A20110717%3A20; JSESSIONID=abcKrMR5EVQv68Os6h9et; __utmc=73758084
Pragma: no-cache
Cache-Control: no-cache

响应:

HTTP/1.1 200 OK
Date: Mon, 18 Jul 2011 13:54:45 GMT
Server: Apache
Last-Modified: Wed, 04 May 2011 10:49:12 GMT
Etag: "28023a-1cf5a-4a27101cc1a00"
Accept-Ranges: none
Cache-Control: max-age=600
Expires: Mon, 18 Jul 2011 14:04:45 GMT
Vary: Accept-Encoding
Content-Length: 118618
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/css

任何想法?

在此先感谢。
马克

Thanks in advance. Marc

推荐答案

远投:就是Apache正确对待你的CSS文件 - 即是在MIME类型配置是否正确?

Long shot: is apache treating your css file correctly - i.e. are the mime types configured correctly?

哪里是你的输出滤波器组,在附带的配置或一个.htaccess [检查的.htaccess允许覆盖]

Where is your output filter set, in an included config or in an .htaccess [check that .htaccess is allowed to override]

您可以删除的过滤器和放大器;看它是否会融为一体preSS的所有内容吗?

Can you remove the filter & see if it will compress all content?

最后 - 在那里,我们可以测试一个公开的网址?

Lastly - is there a public URL we can test?

-Sean

编辑:

同样什么是您使用本地测试?我可以看到在Firefox / Firebug的/ YSlow的正确内容编码。 - [我也看到其他一些问题 - 如果你不使用萤火虫,我建议检查出来[强烈!] - 但除此之外,是的,它出现在你的COM pression正常工作

Hi Again, what are you using to test locally? I can see the correct content encoding in firefox/firebug/yslow. - [I also see several other issues] - if you are not using firebug, I suggest checking it out [strongly!] - but otherwise, yes, it appears your compression is working correctly.

-Sean

这篇关于Apache的mod_deflate模块不COM preSS虽然日志文件说,它会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆