[mod_gzip] Installing

Homer

Well-known member
Okay,

as requested here are the instructions for the installation of mod_gzip.

Mod_gzip is a compression module for Apache, it can reduce your bandwidth / traffic upto 70% !!

Instructions
(commands are bold)
Login to your box as root

Get the mod_gzip source by running:
wget http://www.remotecommunications.com/apache/mod_gzip/src/1.3.19.1a/mod_gzip.c

Next find the path to "apxs":
locate apxs

Now run apxs so it will add mod_gzip to apache
apxs -i -a -c mod_gzip.c
(if it says cant find apxs include the path!)

Now, edit your httpd.conf (locate httpd.conf by running the command:

pico httpd.conf
(path!!)

Add the following lines:

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_min_http 1001
mod_gzip_temp_dir /tmp/mod_gzip
mod_gzip_minimum_file_size 1002
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 1000000
mod_gzip_command_version mod_gzip_show_version


mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.shtml$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.pl$
#mod_gzip_item_include file \.jpg$
#mod_gzip_item_include file \.gif$
#mod_gzip_item_include file \.swf$
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include mime text/html
mod_gzip_item_include mime text/plain
mod_gzip_item_include mime text/richtext
#mod_gzip_item_include mime image/jpeg
#mod_gzip_item_include mime image/gif
mod_gzip_item_include mime "application/x-httpd-php.*"
mod_gzip_item_include mime httpd/unix-directory

mod_gzip_item_exclude file "\.htaccess$"
mod_gzip_item_exclude file "\.htpasswd$"
mod_gzip_item_exclude file "\.css$"
mod_gzip_item_exclude file "\.js$"
mod_gzip_item_exclude file "\.wml$"
mod_gzip_item_exclude mime text/ht

</IfModule>


Save and exit.
Edit your mime.types (locate mime.types
and add:
text/ht htpasswd htaccess

Save and exit.

Create a temp dir for mod_gzip and set rights.
mkdir /tmp/mod_gzip
chmod 777 /tmp/mod_gzip
chown nobody.nobody /tmp/mod_gzip


Restart apache by running:
/etc/rc.d/init.d/httpd restart

Test if mod_gzip is correctly installed by surfing to:
http://www.YOURDOMAIN.com/mod_gzip_show_version
 
HostingFreak said:
will this effect webalizer work ?

Yes, as you can see my example excludes the pass prot. files "htaccess" and "htpasswd".

When mod_gzip compressed these you will get errors, with my example you wont :)
 
Top