我准备了一台运行Magento实例的服务器:Apache + Php-FPM + APC
我遇到的问题是,Apache不会压缩Magento PHP脚本的HTML输出。
在我的.htaccess中我有:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml AddOutputFilterByType DEFLATE application/javascript application/x-javascript AddOutputFilterByType DEFLATE application/x-httpd-php
我也尝试压缩所有:
SetOutputFilter DEFLATE
但是我没有运气。
Zlib压缩被禁用:
php_flag zlib.output_compression on
我的猜测是,这与Php-FPM或APC有关,但我不确定问题是什么。
为未压缩页面返回的mymetypes是:
Content-Type: text/html; charset=UTF-8
有任何想法吗?
更新:问题似乎与PHP处理的任何东西,如果我复制的HTML输出到.html文件,然后获取它,它将被压缩,如果我重命名相同的文件.php并获取它的输出将不会被压缩。 这是标题:
[[回复标题HTML文件]]
Date Fri, 29 Aug 2014 20:03:13 GMT Content-Encoding gzip Last-Modified Fri, 29 Aug 2014 19:53:19 GMT Server Apache/2.2.15 (CentOS) ETag "24002f-34e71-501ca0144a75d" Vary Accept-Encoding,User-Agent Content-Type text/html Cache-Control max-age=10800 Connection Keep-Alive Accept-Ranges bytes Keep-Alive timeout=5, max=100 Content-Length 20884 Expires Fri, 29 Aug 2014 23:03:13 GMT
[[响应头PHP文件]]
Date Fri, 29 Aug 2014 20:05:19 GMT Server Apache/2.2.15 (CentOS) Connection Keep-Alive Keep-Alive timeout=5, max=100 Transfer-Encoding chunked Content-Type text/html; charset=UTF-8
和请求标题:
[[请求标题HTML文件]]
Pragma no-cache Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding gzip,deflate,sdch Host dev.go-parts.com Accept-Language en-US,en;q=0.8 User-Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Cache-Control no-cache Connection keep-alive
[[请求头PHP文件]]
Pragma no-cache Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding gzip,deflate,sdch Host dev.go-parts.com Accept-Language en-US,en;q=0.8 User-Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Cache-Control no-cache Connection keep-alive