启用mod_deflate模块发送内容编码:gzip [英] Enable mod_deflate to send Content-Encoding: gzip

查看:159
本文介绍了启用mod_deflate模块发送内容编码:gzip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改我发现这个问题其实是 PHP缩小。这是发送瘪内容,而不是Apache的。我会找到更多这一点。

EDIT I have found that the problem is actually php minify. This was sending the deflated content instead of Apache. I'll find more on this.

根据高性能网站的,如果我能够在Apache 2.X的mod_deflate模块,通过添加以下行,它应该发送gzip压缩/ delfated内容: -

According to High Performance Web Sites, if I enable mod_deflate in Apache 2.x, by adding the following line, it should send gzipped/delfated content: -

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

这本书还表示,的gzip 更有效的紧缩

我已经在httpd.conf加入同一行启用。但是,Apache的发送内容编码:紧缩

I have enabled in httpd.conf by adding the same line. But Apache sends Content-Encoding: deflate.

我的卷曲用测试: -

I tested with CURL using: -

curl -i -H "Accept-Encoding: gzip" "http://192.168.1.33/s.js" >> e:\curl_log.txt

它返回'gzip压缩'的内容。但是,当我发出命令: -

It returns 'gzipped' content. But when I send the command: -

curl -i -H "Accept-Encoding: gzip, deflate" "http://192.168.1.33/s.js" >> e:\curl_log.txt

它返回瘪的内容。

It returns 'deflated' content.

因此​​,如果浏览器支持放气和gzip压缩,阿帕奇发瘪。如何告诉Apache preFER gzip的紧缩过度?

So, if the browser supports both deflated and gzipped, Apache send deflated. How to tell Apache to prefer gzip over deflate?

FYI: -


  • 我无法找到任何东西:
    <一href=\"http://httpd.apache.org/docs/2.0/mod/mod%5Fdeflate.html\">http://httpd.apache.org/docs/2.0/mod/mod_deflate.html.

  • 有中没有无gzip的发生
    Apache的CONF。

  • 服务器:Apache / 2.2.9(Win32的)PHP / 5.2.6

  • FF发送请求头为:接受编码:gzip,紧缩

推荐答案

在我的原因已经找到。为了进一步的帮助失控可能的混乱:

As I see the cause was already found. To further on help getting out of possible confusions:


  • mod_deflate模块尽管它的名字目前仅支持gzip的。

  • mod_deflate despite its name is currently only supporting gzip.

gzip的更有效的原因主要有以下

gzip is more "effective" because of the following

放气 - 尽管它的名字的zlib玉米pression(RFC 1950)应作为在现实中的RFC 2616中描述的实现(结合的放气的COM pression(RFC 1951))然而,世界似乎zlib的COM pression和(原)不等紧缩COM pression [3] [4]。由于这种混乱,gzip的将自己定位为更加可靠的默认方法(2011年3月)。

deflate - despite its name the zlib compression (RFC 1950) should be used (in combination with the deflate compression (RFC 1951)) as described in the RFC 2616. The implementation in the real world however seems to vary between the zlib compression and the (raw) deflate compression[3][4]. Due to this confusion, gzip has positioned itself as the more reliable default method (March 2011).

gzip和zlib的是文件/流格式,默认情况下回绕放气和除其他事项外添加检查,这使得它们更加安全和慢一点。在另一方面中尺寸的增加应该是没有任何关注的

gzip and zlib are file/stream formats that by default wrap around deflate and amongst other things add a checksum which make them more secure and a little slower. The increase in size on the other hand should not be of any concern.

另请参见 HTTP_com pression - 维基百科

  • deflate would be more "efficient" (Frequently Asked Questions about zlib - What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings)

这篇关于启用mod_deflate模块发送内容编码:gzip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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