I recently needed to speed up the load time of one of my websites, while I didn't want to change the content itself I could change how fast it was delivered with mod_gzip. This tutorial features dynamic integration of mod_gzip with Apache, no recompile ne
How to install mod_gzip
I recently needed to speed up the load time of one of my websites, Ramprage.com - a popular sports website, while I didn't want to change the content itself I could change how fast it was delivered with mod_gzip. This tutorial features dynamic integration of mod_gzip with Apache, no recompile necessary.
mod_gzip is an Internet Content Acceleration module for the popular Apache Web Server. It compresses the contents delivered to the client. There is no need to install any additional software on the client!
Project website: http://sourceforge.net/projects/mod-gzip/
There is also static integration where gzip is compiled directly into the Apache binary but we do not feature that here.
Test Your Current Website for mod_gzip or compression
http://www.desilva.biz/gzip-test.php
http://leknor.com/code/gziped.php
They should say not compressed, meaning you od not have mod_gzip turned on or installed.
Lets Begin!
Login to your server and su to root.
Download the file to a directory of your choice.
wget http://easynews.dl.sourceforge.net/sourceforge/mod-gzip/mod_gzip-1.3.26.1a.tgz
tar -zxvf mod_gzip-1.3.26.1a.tgz
cd mod_gzip-1.3.26.1a/
Open the makefile to edit the path of Apache builder.
pico Makefile
FIND:
APXS?=/usr/local/sbin/apxs
CHANGE TO:
APXS?=/usr/local/apache/bin/apxs
Save and exit the file, Ctrl+X then Y
Lets compile the module, this will NOT affect your current Apache binary.
make
Now the next command will place the files into your folders such as the .so and .c mod_gzip files and add two lines to your httpd.conf file, it will backup the config file first.
make install
Lets take a look at the config file to see what happened and what we need to do.
pico /usr/local/apache/conf/httpd.conf
Find the mod_gzip which was added: Remove comments # from
FIND:
#LoadModule gzip_module libexec/mod_gzip.so
CHANGE TO:
LoadModule gzip_module libexec/mod_gzip.so
FIND:
#AddModule mod_gzip.c
CHANGE TO:
AddModule mod_gzip.c
Save and close the file, Ctrl+x then Y
Run Test
Now everything should be good to go but we want to do a dry run of how Apache is going to handle this new addition.
This will do a test to Apache but won't restart the live server itself, isn't Apache smart like that eh!
/usr/local/apache/bin/apachectl configtest
It might spit our no VirtualDirective or error that some directories are missing, this is normal and fine.
Restart the Live Server to enabled mod_gzip
/etc/init.d/httpd restart
Test It Again, Now you should have compression enabled giving you faster load times.
Cheers from Canada!
About the Author:
Steven Leggett is the editor of the server resource and hosting tutorial site, www.webhostgear.com and specializes in system administration and web development.
WebHostGear.com is a hosting directory, not a web host.
Copyright © 1998-2023 WebHostGear.com