Post Reply  Post Thread 
Speed up downloads for Apache
Author Message
Nilesh
Super Moderator
******


Posts: 42
Group: Super Moderators
Joined: Jul 2007
Status: Offline
Reputation: 0
Thank 0
0 was given thank in 0 posts
Post: #1
Speed up downloads for Apache

Red Hat Enterprise Linux is shipped with an Apache module that enables data to be compressed before being sent to the client over the network. This decreases the amount of time and data being transmitted over the network, resulting in faster downloads for visitors on your server.

Apache uses a module named mod_deflate to compress data being sent to web clients. The example below compresses HTML pages, plain text and xml files. For more advanced configuration visit the mod_gzip web page.

This article assumes that the Apache http daemon is already configured and serving pages.

1. Open /etc/httpd/conf/httpd.conf with your favorite editor. Add the LoadModule option shown below to the file if it does not already exist.

Quote:
LoadModule gzip_module modules/mod_gzip.so


2. Also in the /etc/httpd/conf/httpd.conf, add the lines listed below. Ensure that they the addition is not inside a set of opening or closing tags (For example <Location> ... </Location>Wink.

Quote:
# enable mod_gzip
mod_gzip_on Yes

# the minimum file size before mod_gzip will compress the item
mod_gzip_minimum_file_size 300

# The maximum size of a file that mod_gzip will compress, 0 for none.
mod_gzip_maximum_file_size 0

# The maximum chunk of memory that mod_gzip will be used during file compressiong
mod_gzip_maximum_inmem_size 100000

# Keep temporary work files ( for debugging)
mod_gzip_keep_workfiles No

# Directory to keep workfiles
mod_gzip_temp_dir /tmp

# Used to ensure that scriptiong languages (PHP & Coldfusion) scripts transmit correctly

mod_gzip_dechunk Yes

# Compress files with these extensions
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.cgi$

# compress files with the mime type of text/*
mod_gzip_item_include mime text/.*



The above settings are generic and suit most situations. For further tuning please visit the mod_gzip page for more specific details.

3. Finally start or restart httpd:

Quote:
/sbin/service httpd start
/sbin/service httpd restart


Apache should start normally.

You can test that pages are being compressed by using the lwp-request command. The lwp-request command is installed in the perl-libwww-perl package. In the example below replace http://www.example.com and the requested page with a known page on the web server.

Quote:
lwp-request -e -H 'Accept-Encoding: gzip' http://www.example.com/index.html

If mod_deflate is working correctly, below the above command should return

Content-Encoding: gzip


~~~ Cool Buddy ~~~

ADD TO DEL.ICIO.US  ADD TO DIGG  ADD TO FURL  ADD TO NEWSVINE  ADD TO NETSCAPE 
ADD TO TECHNORATI FAVORITES  Technorati ADD TO SQUIDOO  ADD TO WINDOWS LIVE  ADD TO YAHOO MYWEB  ADD TO ASK 
ADD TO REDDIT  ADD TO STUMBLEUPON  ADD TO GOOGLE   

07-15-2007 10:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Apache configuration tips admin 0 435 07-25-2007 03:09 AM
Last Post: admin
  Apache authentication using .htaccess admin 0 220 07-24-2007 06:32 PM
Last Post: admin

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: