日期:2014-05-16  浏览次数:20860 次

apache2.4.4启用deflate压缩

今天在看《高性能php应用开发》这本书,说道如何启用mod_deflate:

启用如下模块:

LoadModule deflate_module modules/mod_deflate.so

然后加入指令:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

即可。

但是发现老是出错,

 Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration 

去百度查看下,未果,之后发现官方有段话:

Invalid command 'AddOutputFilterByType', perhaps misspelled       or defined by a module not included in the server configuration        -AddOutputFilterByType       has moved from the core to mod_filter, which must be loaded.

原来,除了启用deflate之外,还要启用mod_filter,找到这句:

LoadModule filter_module modules/mod_filter.so

去除前面的分号,终于好了!