Glenn asked me how to enable gzip under Apache, so I figured I would write this post so that everyone could benefit.
To start, mod_gzip has to be compiled in to Apache. This is a stable module, last updated in late 2002. It is possible that it is already installed, so let’s check and see.
Let’s check to see if mod_gzip is already installed. Visit http://web-sniffer.net/ and enter a URL that will be served from your server. Hit the Submit button and await the response. Scroll down to the section labeled HTTP Response Header, and then look for the line labeled “Server:”. My Server line includes the following text (I added the bold-facing):
As you can see from the bolded text, I already have modgzip installed. If your server has modgzip installed, consider yourself lucky (maybe even buy a lottery ticket), and skip down to the section labeled “Configuring mod_gzip.”
If you do not have modgzip installed, then you have to install it. The exact procedure for doing this will vary depending on the Apache configuration and operating system. I installed Apache using Apache Toolbox, and simply checked the modgzip entry in the appropriate menu. Go ahead and install it as appropriate (there’s no way I can know enough about your system to say any more than this), and then come back here.
Now you need to add some entries to your Apache configuration file. On my system this file is called httpd.conf. You will need the following entries:
mod<em>gzip</em>item<em>include mime ^text/.*
mod</em>gzip<em>item</em>include mime ^application/postscript$
mod<em>gzip</em>item<em>include mime ^application/ms.*$
mod</em>gzip<em>item</em>include mime ^application/vnd.<em>$
mod</em>gzip<em>item</em>exclude mime ^image/.</em>$
After you have you configuration set, restart Apache and your feeds should now be compressed. If you get any error messages when you restart Apache, double-check to make sure that mod_gzip is installed.
You may find it necessary to make sure that certain files or file types are not compressed by modgzip. For example, I have several dynamic pages on Syndic8. The pages can product incremental output for several minutes, usually while they munch on a long list of submitted feeds. By default, modgzip would wait until pages like these have finished, and the output would appear all at once (after several minutes) instead of incrementally. To make sure that this doesn’t happy, simply tell mod*gzip not to process these files by adding the following line to your configuration file:
mod</em>gzip<em>item</em>exclude file suggest.php$