EXTREME Overclocking
Home | Reviews | Forums | Downloads | $ EXTREME Deals $ | RealTime Pricing | Free Magazines | Gear | Wiki | Folding Stats Newsletter | Contact Us

How To Install HSC's mod_gzip

Program Location: Hyperspace Comm, Inc.
Date Written: June 10, 2001
Written By:
Jason Rabel

What is mod_gzip?:

To be short and to the point, mod_gzip is an add-in that can compress both STATIC and DYNAMIC web page output on the fly. Basically the request comes in for a web page, then right before it is sent mod_gzip compresses it, it gets sent over the internet compressed, then the clients web browser automatically decompresses and displays it, it's totally transparent! If you run on manage a web site, then definitely read on, this could be the article for you!

Mod_gzip doesn't require any software to be installed on the client side, all that is needed is a HTTP 1.1 compliant web browser which is basically any browser released since early 1999. Even if a user doesn't have a HTTP 1.1 compliant browser, they can still surf your site, mod_gzip just won't compress the pages for them and for all purposes your web site functions just like any other.

Mod_gzip runs on Apache web server for both linux & win32 platforms (and I'm sure you can run it on other *nix platforms as well). It will compress all HTML, PHP, ColdFusion, Perl, Zope, WebLogic, IBM's WebSphere Server Output, EXE, compiled 'C', mod_perl, mod_php, etc.

The benefits of installing mod_gzip are twofold. Not only are you saving bandwidth by sending out smaller files (that can be a lot of money for high-traffic sites), but also your web pages load faster on the client side since it doesn't take as long to download. The impact on the web server itself is minimal, and in some cases the cpu load is actually reduced from using this mod!

Best of all, mod_gzip is free!

 

Installing mod_gzip:

To install mod_gzip you must have root access to your system (or Administrator if you are a Windows machine). With that said, I'm going to assume that you have pretty good knowledge on how to use a text editor, restart your web server, etc... So let's jump right in!

First you will need to download the mod_gzip file from Hyperspace Comm's web site. I downloaded the pre-complied mod_gzip.so file since that was the easiest and quickest way to get up and running. If you are a real die-hard tweaking person you can always get the C source and re-compile it into your Apache web server.

Next I put the mod_gzip.so file on my web server in the same directory as my other modules, which is /usr/lib/apache. Then I set its permissions to the same as the rest of the modules.

With that done, the next step is to edit the config file to have it load the module with the proper settings. For most people this will be in the httpd.conf (like me) or it could possibly be in the access.conf file. My conf files are located in the /etc/httpd/conf directory, but yours may vary.

In the httpd.conf file look for the area where all the other modules load. After the last module, add the line:

LoadModule gzip_module modules/mod_gzip.so

Then in some spot below, add the following lines. This is taken from my config, you can tweak it to suit your needs.

# [ mod_gzip configuration ]
mod_gzip_on Yes
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 100000
mod_gzip_keep_workfiles No
mod_gzip_temp_dir /tmp
mod_gzip_dechunk Yes
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include mime text/.*

If you want to learn more about what these commands are, there is some extensive documentation on all the command HERE. Basically my config lines tell mod_gzip to be used, compress any file over 300 bytes, the max in memory compression is 100,000 bytes, not to keep work files, use /tmp for its temp area, and to dechunk files (needed for PHP4 & ColdFusion). The includes basically tell it to compress all those files & mime types, however you can also specify exclude statements. You can specify either by file, mime, or handler.

Once you have those two bits in place, you can restart your web server and mod_gzip should be running. However there are a couple things you can add in your config file so you can make sure it is running and to see what kind of compression you are getting.

One useful module is mod_info, you can use a couple commands and the web server will return all sorts of info. If you don't have mod_info installed already, you might have to download it if it's not in your modules directory, but if it is there, then just add this line to the end of your modules section in the config file:

LoadModule info_module modules/mod_info.so

Now you can enter the following commands in your web browser to return a bunch of info and to find if mod_gzip is loaded (along with all the other modules). The way my access.conf is set up, I had to add some lines to allow my server-info and server-status to run, and I also have mine password protected for safety measures. To run the server-info and server status, just open your web browser and do the following:

If they don't show up then you are going to have to add the location & handler info in your access.conf files (don't email me how, you can look it up on the web or just look in your access.conf file, it is probably already there but just commented out).

Next you can edit your httpd.conf and add in some extended log info, which will show tell you if mod_gzip compressed the file, and by how much. Here is the line below that I used, although you can tweak it how you want (more info is at the Hyperspace Comm web site). I chose to keep it running separete from my main log file since my stats program probably wouldn't like the extra info. (It's needs to be all one line if you are going to copy & paste it)

LogFormat "%h %l %u %t \"%r\" %>s %b mod_gzip:
%{mod_gzip_result}n In:%{mod_gzip_input_size}n
Out:%{mod_gzip_output_size}
n:%{mod_gzip_compression_ratio}npct." full_plus_gzip

Then under the location where I specify my log stuff, I added the following line. If you are running several web sites on your server, you will need to add it to the virtual server that you want it to log. Also, you might want to specify it where your other logs are just for simplicity sakes.

CustomLog /home/logs/mod_gzip.log full_plus_gzip

Once you have these lines in place, you can restart your web server and it will start cranking out to the new log file. Here is an example line from mine:

/reviews/cooling/HSR2_4.html HTTP/1.1" 200 6289 mod_gzip: DECHUNK:OK In:23352 Out:6289:74pct.

As you can see, the original file was 23,352 bytes, but it compressed it and sent only 6,289 bytes. That can really amount to a lot of bandwidth savings! Once you get it running right, you might want to turn off this log file (comment out the CustomLog line is the easiest) or at least do something to rotate the log and compress the old one.

 

Conclusion:

I know this is by no means thorough documentation on how to install mod_gzip, but at least it should help point you in the right direction. There really is no reason not to use this module, it save bandwidth, works even with the most dynamic files, helps you page load faster on the client end, and might even reduce your CPU load some. Hyperspace Comm's web site is an excellent starting point, and they have several links to other places with help and info. You can always install it with the bare minimum (just putting the LoadModule line in) and always tweaking it to do more after you are sure you have it running right.

I encourage other web sites running apache to try giving this module a chance, your users will be thanking you for the faster load time on pages that have lots of HTML (remember this program doesn't compress graphics, simply because gzip can't compress an image smaller).

I even encourage the enthusiast at home who tinkers with their Linux box to try installing it on their machine. You never know when in the future you might use this.

Back To The Main Page

 

EXTREME Overclocking Newsletter
Thousands of PC enthusiasts are already subscribed to the EXTREME Overclocking Newsletter, have you signed up yet?
Your Email Address:
Sponsored Links
Most Downloaded Files
Recently Added Files
CPU-Z 1.455/16/08
Compare Prices On Top Brands!
Search:
For:

Intel Core 2 Processors
Kentsfield (LGA 775)
QX6850  QX6800  QX6700  Q6700  Q6600
Conroe (LGA 775)
X6800  E6850  E6750  E6700  E6600  E6550  E6420  E6400  E6320  E6300
Allendale (LGA 775)
E4500  E4400  E4300

AMD Athlon 64 Processors
Brisbane (AM2) X2
5000+  4800+  4400+  4000+  BE-2350  BE-2300
Windsor (Socket F) X2
FX-74  FX-72  FX-70
Windsor (AM2) X2
FX-62  6400+  6000+  5600+  5400+  5200+  4600+  4200+  3800+
Orleans (AM2)
4000+  3800+  3500+  3200+  3000+

AMD Opteron Processors
Santa Rosa (Socket F)
2224 SE  2222 SE  2220  2218 HE  2216 HE  2214 HE  2212 HE  2210 HE
Santa Ana (AM2)
1222  1220  1218  1216  1214  1212  1210
Santa Ana (AM2)
1216 HE  1214 HE  1212 HE  1210 HE
Denmark (939)
185  180  175  170  165

DDR3 Memory
PC3-14400  PC3-12800  PC3-11000  PC3-10666  PC3-10600  PC3-8500

DDR2 Memory
PC2-9600  PC2-8500  PC2-8000  PC2-7200  PC2-6400  PC2-5400  PC2-5300  PC2-4200

DDR Memory
PC-4200  PC-4000  PC-3500  PC-3500  PC-2700

Motherboards
ABIT  ASUS  AOpen  Biostar  DFI  Gigabyte  Intel  MSI  Shuttle  Tyan

Video Cards
ATi  BFG  Leadtek  MSI  nVidia  PowerColor  PNY  Sapphire  Visiontek  XFX

Hard Drives
Seagate  Maxtor  Samsung  Fujitsu  Western Digital

  Technology Magazines FREE to Qualified Professionals.
eWeek MagazineeWeek is the essential technology information source for builders of e-business. Focuses on e-commerce, communications and Internet-based architecture. Oracle MagazineOracle Magazine contains technology-strategy articles, sample code, tips, Oracle and partner news, how-to articles for developers and DBAs, and more. Dr. Dobb's JournalDr. Dobb's Journal enables programmers to write the most efficient and sophisticated programs and help in daily programming quandaries. InformationWeekInformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
  Other Popular Titles: PC Magazine, BusinessWeek, Baseline, Business Solutions, Software Magazine, InfoStor, Security Source , TelevisionWeek, more...
  EXTREME Deal Of The Day | More EXTREME Deals
Dell Home - Dell Home Inspiron Laptop and Desktop System Coupons!
A big selection of discount coupons from Dell Home, plus a couple of stackable quick ship ones!  Pay attention to the expiration dates, but they also have redemption limits, so don't wait until the last minute.

  • Inspiron laptop coupons:  DELL INSPIRON LAPTOP DEALS
    • 25% off a $999+ purchase, expiring 5/29/08 at 5:55AM CT, use code: 66Z2MXLFSZF43P
    • 30% of a $1299+ purchase, expiring 5/29/08 at 5:55AM CT, use code: H873GJC2846CV5
    • New masterpieces from Dell and Mike Ming! Special art edition Inspiron 1525 laptops starting at only $699 after discounts.  SPECIAL ART EDITION DELL INSPIRON 1525 LAPTOP DEALS
  • Inspiron desktop coupons:  DELL INSPIRON DESKTOP DEALS
    • $200 off a $749+ purchase, expiring 5/29/08 at 5:55AM CT, use code: RT??6DN57MHBC?
    • $300 of a $999+ purchase, expiring 5/29/08 at 5:55AM CT, use code: Q4MVHZTFT04Z1W
    • Inspiron 530 Mini Desktop with Core 2 Quad Q6600, 3GB DDR2, 500GB HD, and Vista Home Premium for $499 after $260 instant savings, expiring 11/19/08 at 11:59PM CT:  DELL INSPIRON 530 VISTA DESKTOP DEAL
    • Inspiron 530 Mini Desktop with Core 2 Quad Q6600, 3GB DDR2, 500GB HD, and XP Home for $499 after $260 instant savings, expiring 11/19/08 at 11:59PM CT:  DELL INSPIRON 530 XP DESKTOP DEAL
Dell Small Business - Vostro 200 Mini Tower Computer with Dual Core Processor, 2GB SDRAM, 160GB Hard Drive, DVD+/-RW Burner, 19" LCD and Windows XP with Next Business Day On Site Service for Only $429 with FREE Shipping
You get all that see above in a nice compact case ready for any small or home office and all that you could need it to do. The Vostro series comes with no trialware, 24-7 tech support and even a 30 day worry free money back guarantee! No restocking or shipping fees! And of course the business class next business day on site service for you folks. Remember, you don't need to own a business to pick up one of these. Expires 5/28/08. DELL VOSTRO 200 MINI TOWER COMPUTER DEAL
  • For this week only, they've also got the three following deals for those of you who are looking for something else. They all expire 5/28/08.
    • If you prefer more memory with a slightly smaller 19" LCD, you can get it here for just $30 more.
    • OptiPlex 330 with Core 2 Duo, 2GB memory, 19" LCD and a 3 year warranty for only $519 with free shipping. DELL OPTIPLEX 330 COMPUTER DEAL
    • PowerEdge T105 server with AMD Opteron processor, 2GB memory and two 250GB hard drives for only $499. DELL POWEREDGE T105 SERVER DEAL
Copyright © 2000-2008 EXTREME Overclocking. All rights reserved.
Disclaimer of Liability - Privacy Policy