Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enable mod_gzip for Apache UNIX
I wanted to get mod_gzip working with my Apache installation in OS X and I figured that other people might want an easy, step-by-step guide for the procedure so I threw one together. For presentation's sake, I've written up the procedures in an entry on my blog: Exordium.

It should only take about 10 minutes to get your site running with mod_gzip. Simple enough. I hope that it helps somebody out.

[robg adds: I haven't tested this one.]

    •    
  • Currently 3.00 / 5
  You rated: 5 / 5 (4 votes cast)
 
[9,304 views]  

Enable mod_gzip for Apache | 14 comments | Create New Account
Click here to return to the 'Enable mod_gzip for Apache' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Enable mod_gzip for Apache
Authored by: bluehz on Jul 14, '03 10:48:22AM

I never have really understood the purpose of mod_zip compression for Apache. I mean - I am sure at one time when everyone had 14.4k modems, it had its place. But if web pages are created properly, optimized properly - I see no reason for a compression scheme for web pages that may shave a tenth or one-hundreth of a second of the download time for a page.

Maybe I am missing the whole point of mod_gzip....



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: matsur on Jul 14, '03 11:38:00AM

One word: Bandwidth. Since HTML files are easily compressible text, size can be reduced by a factor of twenty. This does add up on a large bandwidth constrained site.



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: cteselle on Jul 14, '03 01:26:44PM

If you are paying per GB transfered for your hosting, this can make quite a difference.



[ Reply to This | # ]
My experiences with mod_gzip were similar - easy and useful
Authored by: VHDLBigot on Jul 14, '03 04:33:53PM
I did these steps some months back as well. It is a simple module to build if you have the developer's tools installed.

Why do this? gzip can compress better than the compression built into modems. When I checked my server logs, I found that most served web pages were typically 1/3 to 1/4 of the original size. For pages that are under 10K, it's not very noticeable but most useful home pages are 25-100KB. I work hard to keep my pages small to begin with...

With a little work you could use mod gzip so that your web pages are actually stored as *.html.gz pages and have mod_gzip unzip only when necessary. *cough* Safari *cough* This could save bandwidth and processor bandwidth used to compress on the fly.

A footnote to cable modem users: a month ago my cable modem provider (the only availabe broadband in my area) decided to block port 80 so there would be no simple webserving from home. Technically running any server was a violation of the terms of service. Luckily my new web host service already has mod_gzip running. I must admit, though, it *was* fun hosting my domain from a humble iMac while it lasted... I learned a bunch about Apache, perl, web virii, etc...

---
--
Scott
BilikFamily.com

[ Reply to This | # ]

Enable mod_gzip for Apache
Authored by: iRideSnow on Jul 14, '03 01:40:12PM

Now if only Safari actually supported gzip compressed pages! I can't understand why Apple went GM with Safari without implementing this relatively basic feature.



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: professor on Jul 14, '03 01:58:59PM

With Apache 2.0.x, it's even easier.

mod_deflate is a standard module, installed by default. All you need to do is to enable it in your httpd.conf file.

<IfModule mod_deflate.c>
DeflateFilterNote ratio
DeflateCompressionLevel 5
 AddOutputFilterByType DEFLATE text/* application/xhtml+xml application/xml \
    application/postscript
</IfModule>


[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: june on Jul 14, '03 02:01:43PM

Hi,

I follow the steps but i'm stock on the make part. I get an error like "make: Command not found" why is that? cant some body help me?

thxs

---
The box siad; win 95 or better, so i bot a macintosch



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: wyvern on Jul 14, '03 03:38:30PM

I'd guess that you don't have the dev tools installed.



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: june on Jul 14, '03 04:06:13PM

no i don't have, i think i'm gona donload it now.
thxs

---
The box siad; win 95 or better, so i bot a macintosch



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: david-bo on Jul 15, '03 06:57:26AM

Are there any similar and easy instruction for mod_dav available? Why can't I find any _easy_ instruction for mod_dav anywhere? I have a server on LAN I want to enable WebDAV on, since it is on a LAN security really is no issue. Any suggestions?

Btw, instructions for how to connect to/mount a WebDAV-server would be very useful too, Mac Help completely misses this:-(

---
http://www.google.com/search?as_q=%22Authored+by%3A+david-bo%22&num=10&hl=en&ie=ISO-8859-1&btnG=



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: mustang_dvs on Jul 16, '03 03:25:01AM

Made the modifications to the sourceforge files that the page notes and it resulted in three odd things that broke Apache when attempting to add this to OS X Server 10.2.6:

  1. httpd_macosxserver.conf & .conf.bak had their permissions changes to -rw------- from -rw-r--r--

  2. the LoadModule call in /etc/httpd/httpd.conf looks for the source code in /library/WebServer/libexec/httpd/ (which does not exist) rather than /usr/libexec/httpd/, where the source is placed

  3. regardless, a configtest ends up reporting: Cannot load /usr/libexec/httpd/mod_gzip.so into server: (reason unknown) ... the source is there and has the correct permissions, but I am unsure as to what is happening.

Anyone have any suggestions? (Other than typing "mv httpd.conf.bak httpd.conf" into the terminal.)



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: andy2307 on Jul 16, '03 05:56:45AM

I am having the same problem as this - any help would be really appreciated.

Again all source files are avaiable with the correct permissions set.

Thanks in advance.



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: andy2307 on Jul 16, '03 06:06:00AM

Ok so I think I have fixed it - this solution works on my Server install anyway.

In the httpd.conf file, I have changed the line that states

LoadModule gzip_module libexec/httpd/mod_gzip.so

with

LoadModule gzip_module /usr/libexec/httpd/mod_gzip.so

and the module now loads correctly.

Hope this helps someone else.



[ Reply to This | # ]
Enable mod_gzip for Apache
Authored by: mustang_dvs on Jul 16, '03 03:19:43PM
andy,

Thanks for the advice, but I already fixed that before posting (10.2 Server sets the ServerRoot to /Library/WebServer/ which isn't "normal" in other Apache configs, but changing it causes OS X fits)

I'm still just scratching my head trying to figure out what I've missed...



[ Reply to This | # ]