apache - mod_deflate 与 mod_gzip

标签 apache gzip mod-deflate

有人可以告诉我以下脚本在 CPU 负载性能和压缩方面的区别吗?

<ifModule mod_gzip.c> 
mod_gzip_on Yes 
mod_gzip_dechunk Yes 
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ 
mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* 
mod_gzip_item_include mime ^application/x-javascript.* 
mod_gzip_item_exclude mime ^image/.* 
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
</ifModule> 


<ifModule mod_deflate.c> 
<filesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </filesMatch> 
</ifModule> 

最佳答案

这两个模块都做同样的事情:即时添加 gzip 压缩。

这些天你应该使用的是 mod_deflate - 它是更现代和推荐的一种,与 Apache 一起分发。 mod_gzip 是一个较旧的第三方实现,没有充分的理由再使用它。

不要被名称所迷惑,以为它们使用不同的压缩方案。它们都使用 gzip(这是一种使用称为 DEFLATE 的压缩算法的格式)。后者仅称为 mod_deflate,因为取名为 mod_gzip。它们都将使用相同的设置实现相同的压缩级别。

它们具有不同的配置(可能包括不同的默认设置),因此您需要查找您正在使用的特定配置的文档。

关于apache - mod_deflate 与 mod_gzip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10255453/

相关文章:

node.js - 如何对通过管道 readStream 传递的内容进行 gZip

Apache:缓存 DEFLATE 文件

apache - rewritecond 不适用于现有文件

linux - 自己开发论坛软件好还是现成的论坛软件好?

php - Gzip 压缩的带有 php header 的 css 文件,第一个 css 行不起作用

gzip - 如何从损坏的 .tar.gz 存档中恢复文件?

apache - 使用 Tomcat 的免费虚拟主机?

apache - 如何在具有不同端口的apache2/ubuntu14.04中的Flask上安装ssl证书

apache - 启用 mod_deflate 发送内容编码 : gzip

apache - 如何配置 mod_deflate 以提供使用 Assets :precompile 准备的压缩 Assets