Elliott C. Back: Internet & Technology

Website Compression with mod_deflate

Posted in Mod_Rewrite, My Blog, Performance by Elliott Back on June 9th, 2007.

I just added mod_deflate to my server by using the following configuration:

LoadModule deflate_module modules/mod_deflate.so
<IFModule mod_deflate.c>
	SetOutputFilter DEFLATE
	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
	SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IFModule>

The static parts of my pages now render with about 70% compression, meaning that I’m saving 2/3 of static page bandwidth now. Server load seems fine!

Update: You can also check the status of your site’s compression using this free online tool. For my site, it read:

URL: elliottback.com/wp/
Web server type: Apache/2.2.9 (Fedora)
Compression status: Compressed (gzip)
File Size Comparison (in bytes):

Original size: 36949 bytes
Compressed size: 11023 bytes
Savings in bytes: 25926 bytes

Percentage saved by compression: 71.0%
Transfer speed improvement: 3.3 X

This entry was posted on Saturday, June 9th, 2007 at 6:06 pm and is tagged with speed improvement, size comparison, request uri, server type, transfer speed, jpe, online tool, server load, apache 2, gzip, fedora, png, text html, web server, lt, bandwidth. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

6 Responses to “Website Compression with mod_deflate”

  1. Luis says:

    Ok, I’m interested, where do I paste this code?

  2. Elliott Back says:

    This goes in your httpd.conf file, of course!

  3. Ken Savage says:

    Is there any mod_deflate package also to install?

    or just edit the conf file?

  4. Elliott Back says:

    It depends; I think the module is standard with apache 2.

  5. Mikhailov says:

    Article about mod_deflate settings like on Amazon EC2 AMI
    http://railsgeek.com/2008/12/16/apache2-httpd-i...

  6. [...] To activate Mod Deflate, use the snippet given by Elliott at: Website Compression with mod_deflate –>site comp with Elliott [...]

Leave a Reply

Powered by WP Hashcash