NetworkClue.com
NetworkClue Home PageHome Contact UsContact ConsultingConsult
Bulletin Board
Internet Services covers Secrets to hosting websites, Hosting your own web server, and using DNS Servers.Operating Systems leads you through the decision of Linux vs. Windows, ideal installations and setups to create an efficient and redundant environment for your business, and great features to make management easier.Routing & Firewalls contains articles that will allow you to take control of your router. Learn how to protect your company with access lists and advanced firewall techniques.Hardware answers the common questions about Switches vs. Hubs, recommends SysAdmin Tools, and recommendations for adequate power protection.Utilities will cover fighting spam, using Anti-Virus programs effectively and the must haves for every administrator's software toolbox.
deflate module

Bulletin Board

Compression in Apache 2.0

By Joshua Erdman
Digital Foundation, inc.

This is my favorite part, setting up compression. We will need to edit the web server configuration file which is: /etc/httpd/conf/httpd.conf

You will definitely need to get used to editing this file. It contains almost all the configuration for the Apache webserver and is used for setting up compression, PHP, hosting multiple websites, etc.
Open the config file by: pico /etc/httpd/conf/httpd.conf

The module used to compress the outgoing HTML is called Deflate. This module only works well with static pages.  If you are planning on using PHP code you shouldn't use compression.  Output tends to get lost in the output buffer when the flush(); command is used.

Now that you have the config file opened, go to the LoadModule section, if you have a clue you will know you are there because it will have a bunch of lines that start with LoadModule.
Add this line:

LoadModule deflate_module modules/mod_deflate.so

Now we must set up the parameters for the webserver to use the defalte module.
So search for the string: AddOutputFilter

You can do this by pressing CTRL-W in pico and then type in whatever text it is that you are searching for in this case it is AddOutputfilter.
Now add this line:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

Finally search for the proxy server directives and add these lines right before them:

<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</Location>
Clue: the ‘#’ sign is a common way to make a note in a config file/pbr>

Article last reviewed: 05/02/2003


del.icio.us

Created by: Digital Foundation, inc.

Copyright © 2002-2005 Digital Foundation, inc.   www.networkclue.com

All content of the NetworkClue website is copyrighted. Articles, notes, outlines, and all other materials may not be stored on the Internet or sold or placed by themselves or with other material in any electronic or printed format in whole or part. However materials may be referenced by links to the site.

 

Related Articles:
Configuring Apache
Handy HTML