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/i5 - Nehalem
975 Extreme  960  950  920
870  860  750  670  661  660

Core 2 Quad - Yorkfield
Q9650  Q9550  Q9400  Q9300  Q8300  Q8200

Core 2 Duo - Wolfdale
E8600  E8500  E8400  E8200  E7300  E7200

AMD Processors
Phenom II X4
965 Black  955 Black  945  925

Phenom II X2
555  550

Athlon II X4
630  620

Athlon II X3
435  425

Athlon II X2
250  245

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
Coupon for 30% off Sitewide at Nautica, plus FREE Shipping on $100+ Purchases!
Nautica has a Father's Day sale right now, with 30% off sitewide. They also have FREE shipping with $100+ purchases.

  • NAUTICA
  • Use code: NAU30 for the discount. Expires 6/18/13.

Dell Inspiron 660 Desktop with 3rd Gen Intel Core i5, 8GB Memory, 2TB HD, DVD Burner, Nvidia GT620, Wireless-N for $519.99 Shipped!

$519.99 after $100 instant discount and stackable $180 coupon buys this originally $799.99 Dell Inspiron 660 desktop including a 3rd gen 3.0Ghz Intel Core i5-3330 processor (with Turbo Boost 2.0 to 3.2Ghz), 8GB DDR3 SDRAM, 2TB 7200RPM hard drive, 16x DVD+/-RW DL, 1GB NVIDIA GeForce GT620 graphics card, 802.11b/g/n wireless, 10/100/1000 Ethernet, 5.1 audio, 8-in-1 media card reader, Windows 8, 15-month McAfee Security Center, and a 1 year warranty.

  • DELL INSPIRON 660 DESKTOP DEAL
  • During configuration, you can add a 10" Dell Latitude 10 essentials Windows 8 32GB tablet ($499 list) for $299 if you want. It's a great deal if you want a Windows 8 tablet.
  • In your cart, use code: DZ5M1X1S0NR048 for the $180 stackable discount. Ends 6/27/13.
Copyright © 2000-2011 EXTREME Overclocking. All rights reserved.
Disclaimer of Liability - Privacy Policy
Secret Forum