How to install Mod_gzip on Linux Server

This is a quick tutorial on how to install mod_gzip on linux server.


cd /usr/local/src
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

You must now open Makefile in your favorite editor and change the first line to:

APXS?=/usr/sbin/apxs

Save it, and continue:

make
make build
make install

Next, open /etc/httpd/conf/httpd.conf. The installer has already modified the httpd.conf file for you, but you’ll need to make some minor changes. When you reach the LoadModule section of httpd.conf, find the mod_gzip line (commented out) and delete it. After all the LoadModules, paste:


LoadModule gzip_module /usr/lib/apache/mod_gzip.so
#LoadModule frontpage_module /usr/lib/apache/mod_frontpage.so
LoadModule perl_module /usr/lib/apache/libperl.so

mod_gzip_on Yes
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 100000
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.shtml$
mod_gzip_item_include file \.shtm$
mod_gzip_item_include file \.jsp$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include mime text/.*
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_include mime httpd/unix-directory
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_exclude file .css$
mod_gzip_item_exclude file .js$
#mod_gzip_item_exclude mime ^image/.*
mod_gzip_dechunk yes
mod_gzip_temp_dir /tmp
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate yes
mod_gzip_send_vary Off
mod_gzip_item_exclude mime ^image/.$
mod_gzip_item_exclude mime ^image/
mod_gzip_item_exclude rspheader Content-Type:image/*
Scroll down and find the AddModule section of httpd.conf. At the end, remove the mod_gzip line (commented out), and below all the AddModules, paste this:

AddModule mod_gzip.c

Save httpd.conf and exit the editor. Finally, restart Apache (service httpd restart).

You can check if your installation was successful by entering a URL athttp://www.gidnetwork.com/tools/gzip-test.php.

css.php