Automatic gzip compression for Apache2 Webservers

Sun, 13. Jun 2010

Categories: en sysadmin Tags: apache Debian gzip htaccess Linux mod_deflate

after failing and failing again in the last months, I finally got it with the help of http://www.debian-administration.org/articles/137

The .htaccess configuration

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript

requires Apache’s mod_deflate enabled via

$ a2enmod deflate
Module deflate installed; run /etc/init.d/apache2 force-reload to enable.

Check the result with http://www.gidnetwork.com/tools/gzip-test.php

Caution: There seems to be an If-Modified-Since/Last-Modified HTTP 304 bug in mod_deflate, so better don’t use it for large, rarely changing files.