I have put the following in my http.conf file:
# mod_deflate configuration
<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
# Level of compression (Highest 9 - Lowest 1)
DeflateCompressionLevel 9
# Netscape 4.x has some problems.
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
My content doesn't return with a Content-Encoding of type gzip, but I find myself getting a lot more 304s and the Etag is appended with a +gzip suffix. Is mod_deflate actually doing its job? (Sorry about the n00b-ishness)
What do the headers tell you, if it is not returning "content-encoding: gzip" it's probably not working.. you can test as follows:
The apache docs for AddOutputFilterByType indicate this directive is deprecated in Apache httpd 2.1 and later and it doesn't always work well if Apache can not determine the mime type.
I would suggest enabling compressing by using something like the following as a starting point and then add all the browser tweaks and compression levels back in. Obviously, you may want to double check httpd.conf to make sure it's actually loading mod_deflate.so as well:
Use cURL as mentioned by Michael Steinfeld to verify.
Can't add acomment as I don't have enough reputation therefore I am writing this as an answer.
The original answer by Michael Steinfeld was outputting the following error (on Windows Command Prompt)
curl: (6) Could not resolve host: gzip,deflate'
I solved it by removing the space after the colon:
curl -I -H 'Accept-Encoding:gzip,deflate' http://yoursite.com/somefile
With
LogLevel
set todebug
, mod_deflate will log its debug messages toErrorLog
. Every resource that is being compressed gets logged out there. You can see if mod_deflate is working in real-time withe.g.