LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
::In The News
::Industry
::Interviews
::Reviews
::Tips
::Tutorials
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Articles :: Tutorials :: Installing mod_gzip with Apache and PHP.

26 February 2002

Introduction

Mod_gzip, at http://www.remotecommunications.com/apache/mod_gzip/ is a module for Apache that allows you to compress content from an Apache web server on-the-fly. It uses the same compression as gzip and no plugins or extra software is needed by your browser to take advantage of this product. Reduction in size of up to 90% or more is possible.


Install

1. Binary install
Download the binary for your platform and follow the instructions in the README under "HOW TO INSTALL"

2. Source install
Download mod_gzip.c and place it in the Apache source directory, ie $HOME/apache_1.3.XX/
If you're using v 1.3.17.1a of mod_gzip then apply the following patch by saving it to the same directory as mod_gzip.c: mod_gzip.1.3.17.1a.patch
and running the following commands:

patch mod_gzip.c < mod_gzip.1.3.17.1a.patch

This solves a problem fixed by Artem Koutchine.
Compile it as a DSO or statically into the web server itself. This is documented in the Apache README.configure
ie. "--add-module=mod_gzip.c"

Install Apache with "make install"


Configuration

Add the following to httpd.conf

# MOD_GZIP configuration
mod_gzip_on Yes
mod_gzip_minimum_file_size  1002
mod_gzip_maximum_file_size  0
mod_gzip_maximum_inmem_size 60000
mod_gzip_item_include mime "application/x-httpd-php"
mod_gzip_item_include mime text/*
mod_gzip_item_include mime "httpd/unix-directory"
mod_gzip_dechunk Yes
mod_gzip_temp_dir "/tmp"
mod_gzip_keep_workfiles No
mod_gzip_item_include file "\.php3$"
mod_gzip_item_include file "\.txt$"
mod_gzip_item_include file "\.html$"
mod_gzip_item_exclude file "\.css$"
mod_gzip_item_exclude file "\.js$"

and save the file.
Run
../bin/apachectl configtest
to make sure everything is ok, and then restart the webserver with
../bin/apachectl restart


Testing

It's never a good idea to introduce new software without testing. Here's some thoughts on how to test it without distrupting your users browsing (too much).
  1. Run the web server on a different port. Try port 8080 and hit your webserver with the URL http://yourhost:8080/ in as many browsers as you can find.
  2. Surround the above configuration with "Directory" directives so that mod_gzip is only active in one directory, and not site-wide.
    <Directory "/usr/local/apache/htdocs/testingdirectory/">
     MOD_GZIP configuration
    </Directory>
    
  3. Use the Logformats described in the README to find out what is and what"s not being compressed.
  4. Test all your applications to verify any device that your site supports will play nicely with mod_gzip.

Conclusion

Mod_gzip is amazing. You'll find large 100K HTML pages come down the wire as 12K compressed files. Your users will be very impressed by the new speed of your site.
From my viewing of several log files, it looks like MSIE is fairly hit and miss as to whether it will compress data or not. Netscape in Linux works very well, and the KDE Konqueror browser supports compression too.
It appears that Java applets don't support compression, even though the browser they're running in might do so. (Only Netscape tested)
If you use mod_gzip, subscribe to the mod_gzip mailing list, as any web content on mod_gzip grows out of date fairly quickly (including this one I guess).


Links

  • mod_gzip
  • Zope and mod_gzip
  • Installing mod_gzip under apache
  • HTTP Compression Speeds up the Web
  • Search Google for mod_gzip


    Copyright Donncha O Caoimh, 2001.


    About the author, Donncha O'Caoimh.

    USERS COMMENTS


                                                                                                        

  •  

    Hosted by HEAnet


    Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
    RSS Version
    Powered by Dell