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

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 Duo - Wolfdale
E8600  E8500  E8400  E8200  E7300  E7200

AMD Processors
Phenom II X4
965 Black  955 Black  945  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 - Dell Laptop Coupon Codes
Dell Laptop DealsCoupon codes for laptops at Dell Small Business expiring 2/10/10.  None of the coupons work on fast-track systems:

  • 40% off a $1099+ Dell Vostro 1320 laptop purchase, use code: 5RS50Q52ZHC?9S  DELL VOSTRO 1320 LAPTOP DEALS
    • Use this code to get one with 2.26Ghz Intel Core 2 Duo P7570 w/VT, 4GB DDR2, 500GB 7200RPM HD, 8x DVD+/-RW DL, 256MB NVIDIA GeForce 9300M GS, 802.11b/g wireless, Dell 355 Bluetooth 2.0, 1.3MP webcam, Windows 7 Home Premium, and plant a tree ($3, to reach $1099) for $659.40 after $439.60 coupon discount!
  • 35% off an $899+ Dell Latitude E5400 laptop purchase, use code: K1XJHK724?ZMC3  DELL LATITUDE E5400 LAPTOP DEALS
  • 25% off a $999+ Dell Latitude E6500 laptop purchase, use code: MWMPT12J35FQ90  DELL LATITUDE E6500 LAPTOP DEALS
  • Update: 1 more: 32" Sharp LC-32DV27UT LCD HDTV with built in DVD player for $399 after $150 instant discount.  SHARP LC-32DV27UT 32-INCH 720P LCD HDTV WITH DVD PLAYER DEAL
Lenovo US (ThinkPad) - ThinkPad T500 Laptop with 15.4" WSXGA+ TFT, Core 2 Duo, 4GB of Memory, 250GB Hard Drive, DVD+/-RW, ATI Radeon 256MB Video and More for Only $929 with FREE Shipping!
Lenovo ThinkPad T500 LaptopThis is a great price on a fully loaded T500 laptop! The high point (for me anyway) is the hot 15.4" WSXGA+ display with CCFL backlit that gives you a sweet 1440x900 resolution! You also get a sweet ATI Mobility Radeon 3650 dedicated video with 256MB of memory, a 2.53GHz Intel Core 2 Duo processor, 4GB of DDR3 SDRAM memory, 250GB hard drive, a slim dual layer DVD+/-RW drive, 802.11b/g/n, integrated webcam, 6 cell battery and Windows 7 Home Premium 64bit. Usually $1544, you get an instant $615 off making it just $929 with free shipping! Expires 2/10/10. LENOVO THINKPAD T500- LAPTOP DEAL

Copyright © 2000-2010 EXTREME Overclocking. All rights reserved.
Disclaimer of Liability - Privacy Policy