EXTREME Overclocking
Home | Reviews | EOC Forums | File Downloads | RealTime Pricing Engine | Folding Stats 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

 

Most Downloaded Files
Recently Added Files
Compare Prices On Top Brands!
Search:
For:

Intel Processors
Core i7 - Haswell
i7-4770K  i7-4771  i7-4790  i7-4770  i7-4790S  i7-4770S

Core i5 - Haswell
i5-4670K  i5-4690  i5-4690S  i5-4590S  i5-4570  i5-4460  i5-4590  i5-4440S  i5-4430  i5-4440

Core i3 - Haswell
i3-4340  i3-4370  i3-4350  i3-4360  i3-4330  i3-4130T  i3-4160  i3-4130  i3-4150

AMD Processors
Vishera 8-Core AM3+
FX-9590  FX-9370  FX-8370  FX-8370E  FX-8350  FX-8320  FX-8320E

Vishera 6-Core AM3+
FX-6350  FX-6300

Kaveri 4-Core FM2+
A10-7850K  A10-7800  A10-7700K  A8-7600

Video Cards
nVidia GeForce GTX 900 Series
GTX 980  GTX 970  GTX 960

nVidia GeForce GTX 700 Series
GTX 780  GTX 760  GTX 750

AMD Radeon R9 Series
290X  290  285  280X  280  270X  270

AMD Radeon R7 Series
265  260X  250X  250  240

Search By Brand
ASUS  Diamond  eVGA  Gigabyte  MSI  PowerColor  PNY  Sapphire  Visiontek  XFX  Zotac

PC Memory
DDR3  DDR2  DDR

Motherboards
ASUS  ASRock  Biostar  ECS  eVGA  Foxconn  Gigabyte  Intel  MSI  Shuttle  Supermicro  Tyan 

Hard Drives & SSDs
Corsair  Crucial  Fujitsu  HGST  Intel  OCZ  Samsung  Sandisk  Seagate  Western Digital

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