gzip使用symfony2压缩动态内容 [英] gzip compress dynamic content with symfony2
问题描述
告诉symfony2尊重Web浏览器发送的"Accept-Encoding"标头和(如果可能)gzip压缩响应中的呈现内容是否容易/可行?
Is it easy/possible to tell symfony2 to respect the "Accept-Encoding" header sent by web browsers and (if possible) gzip-compress rendered content in the response?
基于 http://developer.yahoo.com/performance/rules.html# gzip 似乎是个好主意.
推荐答案
如果您使用的是Apache httpd,则非常简单-只需在httpd.conf中启用mod_deflate模块,然后为不同类型添加AddOutputFilterByType行(更多信息)此处的信息: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html ).我不相信symfony2本身可以gzip压缩某些内容,因为这通常是Web服务器的工作.
If you are using Apache httpd, then it is quite easy - Just enable the mod_deflate module in the httpd.conf and add AddOutputFilterByType lines for the different types (more info here: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html). I do not believe that symfony2 can gzip something by itself, as this is normally a job for the web server.
这篇关于gzip使用symfony2压缩动态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!