不推荐使用 Apache AddOutputFilterByType.如何使用 mod_filter 重写? [英] Apache AddOutputFilterByType is deprecated. How to rewrite using mod_filter?
本文介绍了不推荐使用 Apache AddOutputFilterByType.如何使用 mod_filter 重写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AddOutputFilterByType 在阿帕奇.
文档说使用 mod_filter.
我目前使用
AddOutputFilterByType DEFLATE text/html
使用 mod_filter?
推荐答案
AddOutputFilterByType
在 httpd-2.2
中有严重的限制,因此在那里被标记为已弃用.但在 httpd-2.4
中,此指令被移至 filter_module
,已更正且未弃用.
AddOutputFilterByType
had severe limitations in httpd-2.2
so it was marked deprecated there. But in httpd-2.4
this directive was moved to filter_module
, corrected and un-deprecated.
在 apache 2.2 中,您应该启用 filter_module
和 deflate_module
并使用:
In apache 2.2 you should instead enable filter_module
and deflate_module
and use:
# Declare a "gzip" filter, it should run after all internal filters like PHP or SSI
FilterDeclare gzip CONTENT_SET
# "gzip" filter can change "Content-Length", can not be used with range requests
FilterProtocol gzip change=yes;byteranges=no
# Enable "gzip" filter if "Content-Type" contains "text/html", "text/css" etc.
FilterProvider gzip DEFLATE resp=Content-Type $text/html
FilterProvider gzip DEFLATE resp=Content-Type $text/css
FilterProvider gzip DEFLATE resp=Content-Type $text/javascript
FilterProvider gzip DEFLATE resp=Content-Type $application/javascript
FilterProvider gzip DEFLATE resp=Content-Type $application/x-javascript
# Add "gzip" filter to the chain of filters
FilterChain gzip
deflate_module
只会向在请求标头中声明支持 gzip
编码的浏览器提供压缩内容.
deflate_module
would only serve compressed content to browsers that declare support for gzip
encoding in request header.
这篇关于不推荐使用 Apache AddOutputFilterByType.如何使用 mod_filter 重写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文