Enabling Compression On Apache 1.3
Unlike Apache 2, which can use the mod_deflate compression module, Apache 1.3 uses mod_gzip, which is developed separately to Apache. It is possible to download the module compiled for some platforms, including Windows, but otherwise you will have to recompile Apache yourself, which is outside the scope of this guide. See http://schroepl.net/projekte/mod_gzip/install.htm for more details and module downloads.
You should have a file called mod_gzip.so (for Unix) or ApacheModuleGzip.dll (for Windows) before proceeding.
Open the Apache configuration file. If you are running Apache on Windows, add the following line at the end of the file:
LoadModule gzip_module modules/ApacheModuleGzip.dll
For Unix, add the following line instead:
LoadModule gzip_module modules/mod_gzip.so
In either case, then add the following:
AddModule mod_gzip.c mod_gzip_on Yes mod_gzip_can_negotiate Yes mod_gzip_static_suffix .gz AddEncoding gzip .gz mod_gzip_minimum_file_size 500 mod_gzip_maximum_file_size 500000 mod_gzip_maximum_inmem_size 60000 mod_gzip_item_exclude reqheader "User-agent: Mozilla/4.0[678]" mod_gzip_item_exclude reqheader "User-agent: Mozilla/4.0 \(compatible; MSIE 4" mod_gzip_item_include file \.html$ mod_gzip_item_include mime ^text/html$ mod_gzip_item_include mime ^text/plain$ mod_gzip_dechunk Yes mod_gzip_send_vary On
This configuration will disable compression for Internet Explorer 4 and Mozilla 4.06-8 as these browsers are reported to have several compression handling bugs. In order to ensure maximum compatibility, this configuration does not compress JavaScript or CSS; these could optionally be added.
Restart Apache to activate the new configuration.
Note: mod_gzip creates temporary copies of compressed files on disk. It is worth monitoring your Apache server to see if this is causing any delay due to the file IO - if so then there are two actions that may help:
- Manually pre-compress static content for mod_gzip versions prior to 1.3.26.1a (later versions do this automatically);
- Set up a RAM disk and configure Apache to use this for its temporary files.
More documentation on mod_gzip is available at http://schroepl.net/projekte/mod_gzip/index.htm.