EXTREME Overclocking
Home | Reviews | Forums | Downloads | $ EXTREME Deals $ | RealTime Pricing | Free Magazines | Gear | 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.4912/12/08
Compare Prices On Top Brands!
Search:
For:

Intel Processors
Core i7 - Nehalem
965 Extreme  940  920

Core 2 Extreme - Yorkfield XE
QX9775  QX9770  QX9650

Core 2 Quad - Yorkfield
Q9650  Q9550  Q9400  Q9300  Q8300  Q8200

Core 2 Quad - Kentsfield
Q6600

Core 2 Duo - Wolfdale
E8600  E8500  E8400  E8200  E7300  E7200

AMD Processors
Phenom II X4
940 Black  920

Phenom X4
9950 Black  9850 Black  9750  9650

Phenom X3
8750  8650  8450

Athlon X2
7750 Black  6000+  5600+  5400+  5200+  5000+  5050e  4850e

Video Cards
nVidia GeForce GTX 200 Series
GTX 295  GTX 285  GTX 280  GTX 260

nVidia GeForce 9 Series
9800 GX2  9800 GTX+  9800 GTX  9800 GT  9600 GT  9600 GSO

ATI Radeon HD 4000 Series
4870 X2  4870  4850  4830  4670  4650

Search By Brand
ASUS  BFG  Diamond  eVGA  Gigabyte  HIS  MSI  Palit  PowerColor  PNY  Sapphire  Visiontek  XFX

PC Memory
DDR3  DDR2  DDR

Motherboards
ASUS  Biostar  DFI  ECS  eVGA  Foxconn  Gigabyte  Intel  MSI  Shuttle  Supermicro  Tyan  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 Small Business - Four Dell Desktop Deals
Dell Hot DealsFour Dell desktop deals expiring 7/8/09:

  • $439 plus shipping after $262 instant discount: Dell Vostro 220 Mini Tower desktop with 2.8Ghz Intel Core 2 duo E7400, 3GB DDR2 SDRAM, 250GB HD, 48x CD-RW/DVD combo, Windows Vista Home Basic, a 1 year warranty, plus a 18.5" Dell E1910H LCD monitor.  DELL VOSTRO 220 MINI TOWER DESKTOP
  • $479 plus shipping after $257 instant discount: Dell Vostro 220 Slim Tower desktop with 2.8Ghz Intel Core 2 duo E7400, 3GB DDR2 SDRAM, 250GB HD, 48x CD-RW/DVD combo, Windows Vista Home Basic, a 1 year warranty, plus a 18.5" Dell E1910H LCD monitor.  DELL VOSTRO 220S SLIM TOWER DESKTOP
  • $519 after $288 instant discount with FREE shipping: Dell Optiplex 360 Mini Tower desktop with 2.8Ghz Intel Core 2 duo E7400, 2GB DDR2 SDRAM, 320GB HD, Windows Vista Home Basic, a 3 year warranty, plus a 22" Dell E2209W LCD monitor.  DELL OPTIPLEX 360 MINI TOWER DESKTOP
  • $688 after $325 instant discount with FREE shipping: Dell Precision T3400 workstation with 2.66Ghz Intel Core 2 duo E7300, 2GB DDR2 SDRAM, 160GB HD, 16x DVD-ROM, 256MB NVIDIA NVS290 Video, Windows Vista Business w/XP Pro downgrade, a 3 year warranty, plus a 19" Dell E1909W LCD monitor.  DELL PRECISION T3400 TOWER WORKSTATION
HP Home & Home Office Store - $500 off the Purchase of the HP HDX 16t Notebook PC AND HP Mini 110 XP Netbook! Get them BOTH for only $979.98!
HP HDX 16t Laptop Deal HP MINI 110 XP NETBOOK DEAL HP just released a new coupon that makes the HP HDX 16t and the HP Mini 110 XP bundle even cheaper! Here's what you can get with this coupon:
  • HP HDX 16t Notebook PC w/ 16.0" Screen, 2.2GHz Core 2 Duo, 4GB RAM, 320GB HDD, 512MB NVIDIA GeForce 9600M GT, Blu-Ray, Webcam, Fingerprint Reader, Wireless-N, 64-bit Vista Home Premium. HP HDX 16t 16.0" NOTEBOOK PC DEAL
  • HP Mini XP Netbook w/ 10.1" LED Backlit Screen, 1.60GHz Intel Atom N270, 160GB HDD, 1GB RAM, Intel Graphics Media Accelerator 950, 5-in-1 Digital Media slot, Wireless-G, Windows XP Home SP3. HP MINI 110 XP NETBOOK DEAL
Simply configure and add each to your cart and then use coupon code: NBX4235 to get $500 off! Expires after 200 uses or on 07/07/2009. This is a great deal! And if you don't need a netbook, you could always sell the Mini 110 XP to a friend or eBay it! HP HDX 16T MINI 110 XP BUNDLE DEAL
Copyright © 2000-2009 EXTREME Overclocking. All rights reserved.
Disclaimer of Liability - Privacy Policy