HOWTO: Install mod_gzip

loopforever

Verified User
Joined
May 30, 2003
Messages
298
Location
/home/admin
**UPDATE March 30, 2005 **
I noticed a number of posts in this thread regarding imaging caching issues. I have updated the mod_gzip configuration below to resolve this issue. If you find you are experiancing image caching issues, I suggest you use this new configuration.

Code:
cd /root
wget [url]http://aleron.dl.sourceforge.net/sourceforge/mod-gzip/mod_gzip-1.3.26.1a.tgz[/url]

tar zfx 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:

Code:
make build
make install

Next, open /etc/httpd/conf/httpd.conf in your favorite editor. 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:
Code:
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

<IfModule mod_gzip.c>
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/*
</IfModule>

Scroll down a bit future 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:
Code:
AddModule mod_gzip.c

Save httpd.conf and exit the editor. Finally, restart Apache (/etc/rc.d/init.d/httpd restart).

You can check if your installation was successful by entering a URL at http://www.port80software.com/tools/compresscheck and seeing if it returns mod_gzip in the header.

Enjoy :).
 
Last edited:
search and destroy IE :)

I installed mod_gzip to my DA server using these instructions.
But there is something wrong after installation.
Everthing seems ok . Mod_Gzip is working but my IE6 + SP1 on my winxp pro is NOT caching images.

So I make some tests using this configuration Both Opera7 netscape and Mozilla caches images as expected. But IE6 + SP1 stops image caching after this configuration applied.

IE6 as usually downloads and puts a single big file in to temporary folder. But request images evertime from the server. As from the statistics of a sample site my users %90 uses IE 5+6 so there is no use of this configuration. Mod_gzip installed I use much more bandwidth than I try to save..

So I edited this config a little bit there is a problem with image mime stuff. I read form original config file of mod_gzip it says that you don`t have to include or exclude a full type but only add an mime type.

Code:
LoadModule gzip_module        /usr/lib/apache/mod_gzip.so

<IfModule mod_gzip.c>
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 file .jpg$
mod_gzip_item_exclude file .gif$

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
</IfModule>

does the trick for IE6+SP1 but I have got more than 60 left without caching in server image mime types..

Anyway this is something with mimetypes. But I did not have a all OK fix. So for now I stopped using mod_gzip.

I really want to know if someone dealt with this problem before..
If yes what is the correct config file for mod_gzip in apache 1.3.28 default DA installation..
 
Last edited:
Is there an answer for this yet? I'm concerned about trying to compress images...

Thanks,
John
 
I was just playing around with this, and I found the image caching fix with Firebird (haven't tested with IE yet).

When Firebird:

1) Reaches it's cache size limit or
2) Has already cached a page, but not the images...

It will refuse to cache the images. So, all you need to do is clear the cache in Firebird, reload the page, and it works :).
 
Hi,
can inform the directadmin creators if it is stable to use modgzip?
I have bad expirience of cpanel with modgzip, so it is needed to be sure that modgzip can working fine with directadmin apache.
I use freebsd 4.9
Thanks a lot.
Regards,
Christos
 
Hello,

I couldn't say if modgzip was stable or not, but I don't see why it wouldn't be. DA has no dependancy on any particular build of apache.

John
 
mod_gzip with mod_ssl ??

I heard that there were problems with running mod_gzip and mod_ssl . Is anyone doing this. If so, have you had any problems?

I found THIS but the date on it is almost 2 years ago. Is this still an issue?

cheers,
brandt
 
Hi,

I am running RH 9.0 with apache mod_gzip + mod_ssl without any problems.
 
Ok,

I followed this How-to and it worked for webpages. My problem I'm having now is people can NOT download files via. a hyperlink. If they type in the address WITHOUT http:// it will work. ie. domain.com/file.exe will work... but http://domain.com/file.exe will NOT work. Any reason why this would be???
 
is mod_gzip installed by default for the most recent DA? reason is because i found all my site already have gzip enabled.

i doubt this is necessary in the feature. am i right about it?
 
Last edited:
okay, my question, how do i tell if mod_gzip is installed?

thanks a lot!
 
i'm confused.

since we are going to install Mod_gzip, why

1. we need to
find the mod_gzip line (commented out) and delete it.

are you referring this line in httpd?


#LoadModule gzip_module /usr/lib/apache/mod_gzip.so

2. where to add
AddModule mod_gzip.c
?

i've had this in my httpd

it's at the end of
# Reconstruction of the complete module list from all available modules

</IfDefine>
#AddModule mod_gzip.c

after i comments out this line, i can't restart my httpd, what's wrong with my setting?
 
okay, i commenced out both lines

LoadModule gzip_module /usr/lib/apache/mod_gzip.so
AddModule mod_gzip.c

now httpd restarted, how can i check the performance? i've used these two:

http://www.desilva.biz/gzip-test.php
http://leknor.com/code/gziped.php

But before i install Mod_gzip, i found most of my pages are gzipped already, there is no imporvement after install Mod_gzip.

my question, do i recommand my users who run forums such as vbulletin or IPB to switch off their gzip?
 
Has anyone had problems installing it according to this guide with the most recent DA ?

I've had a Cpanel servera long time, and I got DA with this new machine. I followed this guide, the one on i4net , the ones on Cpanel's forums, the ones on EV1 -- I couldn't seem to get it working with DA.

I got the following error.

-------------
Syntax error on line 1562 of /etc/httpd/conf/httpd.conf:
Invalid command 'SSLEngine', perhaps mis-spelled or defined by a module not included in the server configuration
-------------

When we took out all modgzip tags - things are fine.

So I would like to know if someone got something familiar to this recently. I need modgzip more than anything else. I don't ever use SSL, and I don't plan to host sites that need it either. So if someone can even tell me how tot totally remove that module, I wouldn't mind. Though I suspect my problem might be else where. We've not edited the httpd at all other than the changes that were specified in the guide in here.
 
my question, do i recommand my users who run forums such as vbulletin or IPB to switch off their gzip?

Forum programs usually come with GZip activated. Don't tell them to turn it off, as in most cases the gzip is set to compress at CPU leve 1 - the minimal one. The Mod_Gzip has hard coded value of 6 - which saves you a few comre KB, but it uses a lot of CPU power comparatively to not make it worth it to be set that high. In the future versions they are going to let people select the compression level.

ModGzip is vastly helpful, when you've got lots of static pages. You will get around 70% in compression. IT will save you a lot of bandwidth. However, if you install it, you might be restriting your income, as your users can serve more pages, and use less bandwidth.
 
is it possible to set the mod_gzip level to 1 instead of 6?

is this howto still uptodate?
 
I might try this if someone knows a way to make it use compression level 1.
 
Back
Top