Red Hat Enterprise Linux > Web Server > Issue
<<
17 of 73
>>
Issue:
How can I speed up downloads for Apache 1.0?
Resolution:
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.
-
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.
LoadModule gzip_module modules/mod_gzip.so
|
- 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>).
# 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.
-
Finally start or restart httpd:
/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 www.example.com and the requested page with a known page on the web server.
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
Red Hat Enterprise Linux
>
Web Server
> Issue
<<
17
of
73
>>