Get More Out of Your Pipe with Apache and mod_gzip
It's Not Magic
Some Web sites seem like they are designed to annoy and alienate visitors. Teeny tiny fixed fonts, weirdo fixed page widths, ad servers on Mars, and the content won't load until the ads do, and all kinds of dynamic jiggery-pokery that does everything but quickly deliver a nice, readable page.
Webmasters who are serious about running high-performance Web servers, and who want pleased and delighted visitors, have a great tool in Apache 1.3's mod_gzip. mod_gzip compresses pages on the fly, reducing their size considerably. Depending on the types of files served, you'll see size reductions ranging from 20%- 80%, and a nice increase in server efficiency. Nothing is needed on the client side, except sane modern Web browsers like Mozilla, Firefox, Opera, Galeon, and Konqueror. Mozilla, Firefox, and Opera are nice cross-platform browsers with all kinds of neat features, so don't be afraid to standardize on one of them. You won't be sorry. Internet Explorer more or less supports mod_gzip, but some file formats, such as .pdf, don't always render correctly, and it's a big security hole anyway. You'll want to check out the Resources section below for links that clarify some of the issues assorted browsers have with gzipped content.
mod_gzip compresses static files, and any CGI-generated pages. You'll get the same results as using gzip on any file: Files that are already highly-compressed, like .jpg, won't compress much further, and text files will shrink a lot.
It's not magic, but good smart design and coding. When Josephine Surfer wanders to your Web site, Apache checks the headers sent by her Web browser and looks for the "Accept-encoding: gzip" HTTP request header. Apache smiles, and sends some headers in return: Content-Type: text/html and Content-Encoding: gzip. Josephine's Web browser now knows that it will receive nice lean gzipped pages, and must expand them as HTML pages.
You, the ace Webmaster, define in httpd.conf exactly which mime types and file types will be gzipped, and there are a whole lot of them. See the Configuration section.
mod_gzip is available in the usual package formats, and source tarballs. If your particular package does not include bales of documentation, including HTML docs and a well-commented sample configuration file, get the tarball. It's only 415 kilobytes, a small price to pay to get the good documentation.
To build mod_gzip from sources, first edit the Makefile, giving it the path to the apxs file on your system. Usually this is /usr/bin/apxs. (Debian users, you'll need the apache-dev package to get this file.) It's the first line in the file:
Change this to
$ make # make install
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Gives Up on Upstart, Ubuntu and Linux Kernel Updates