TechiePark

How to enable GZIP Compression in Apache Server to Speed up Website


Compression is a simple and effective way to speed up your site. Modern browsers supports gzip compressed content and are capable of uncompressing gzip data into plain text.

The gzip module configuration depends on your Apache Server version:
Apache 1.3 uses mod_gzip while Apache 2.x uses mod_deflate.

mod_gzip configuration for Apache 1.3.x:

<IfModule mod_gzip.c>
 mod_gzip_on Yes
 mod_gzip_dechunk Yes
 mod_gzip_item_include file \.(html?|txt|css|js|php)$
 mod_gzip_item_include handler ^cgi-script$
 mod_gzip_item_include mime ^text/.*
 mod_gzip_item_include mime ^application/x-javascript.*
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
 </IfModule>


mod_deflate configuration for Apache 2.x:

<IfModule mod_deflate.c>
 SetOutputFilter DEFLATE 
 # Don't gzip
 SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
 SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary 
#Dealing with proxy servers
 <IfModule mod_headers.c>
 Header append Vary User-Agent
 </IfModule>
</IfModule>

Online web page compression / deflate / gzip test tool
1. Port80 Compression Check
2. GIDZipTest

Resources
Apache Module mod_deflate
Compressing Web Content with mod_gzip and mod_deflate
Speed up Apache 2.0 web access or downloads with mod_deflate

Related Posts:

3 Responses


sunnybear September 15, 2012 at 11:26 am

A lot of more interesting things about server side support and performance haven’t been covered. Please check these articles:
http://www.speedingupwebsite.com/2010/01/08/use-the-gzip-power/ and http://www.speedingupwebsite.com/2010/01/09/static-gzip-or-compression-without-compression/


TechiePark September 15, 2012 at 11:26 am

Thanks sunnybear for sharing useful articles !!!


Things to do to improve site performance and reduce CPU Load | Monlam Designs September 15, 2012 at 11:26 am

[…] more infor => http://www.techiepark.com/tutorials/how-to-enable-gzip-compression-in-apache-server-to-speed-up-webs… […]


Comments are closed.