I have prepared a server to run a Magento instance with: Apache + Php-FPM + APC
The problem I have is that Apache is not compressing the HTML output from the Magento PHP scripts.
In my .htaccess I have:
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
I also tried compressing all with:
SetOutputFilter DEFLATE
But I had no luck.
Zlib compression is disabled:
php_flag zlib.output_compression on
My guess is that this have something to do with Php-FPM or APC, but I'm not sure about what the problem is.
The mime-type returned for the uncompressed pages is:
Content-Type: text/html; charset=UTF-8
Any ideas?
UPDATE: The problems seems to be with anything that is processed by PHP, if I copy the html output to a .html file and then fetch it, it will be compressed, if I rename the same file to .php and fetch it the output won't be compressed. Here are the headers:
[[RESPONSE HEADER HTML FILE]]
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
[[RESPONSE HEADER PHP FILE]]
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
And the request headers:
[[REQUEST HEADER HTML FILE]]
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
[[REQUEST HEADER PHP FILE]]
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