online prescription solutions
online discount medstore
pills online
buy lorazepam without prescription
xanax for sale
buy xanax without prescription
buy ambien without prescription
ambien for sale
buy modafinil without prescription
buy phentermine without prescription
modafinil for sale
phentermine for sale
lorazepam for sale
buy lexotan without prescription
bromazepam for sale
xenical for sale
buy stilnox without prescription
valium for sale
buy prosom without prescription
buy mefenorex without prescription
buy sildenafil citrate without prescription
buy adipex-p without prescription
librium for sale
buy restoril without prescription
buy halazepam without prescription
cephalexin for sale
buy zoloft without prescription
buy renova without prescription
renova for sale
terbinafine for sale
dalmane for sale
buy lormetazepam without prescription
nobrium for sale
buy klonopin without prescription
priligy dapoxetine for sale
buy prednisone without prescription
buy aleram without prescription
buy flomax without prescription
imovane for sale
adipex-p for sale
buy niravam without prescription
seroquel for sale
carisoprodol for sale
buy deltasone without prescription
buy diazepam without prescription
zopiclone for sale
buy imitrex without prescription
testosterone anadoil for sale
buy provigil without prescription
sonata for sale
nimetazepam for sale
buy temazepam without prescription
buy xenical without prescription
buy famvir without prescription
buy seroquel without prescription
rivotril for sale
acyclovir for sale
loprazolam for sale
buy nimetazepam without prescription
buy prozac without prescription
mogadon for sale
viagra for sale
buy valium without prescription
lamisil for sale
camazepam for sale
zithromax for sale
buy clobazam without prescription
buy diflucan without prescription
modalert for sale
diflucan for sale
buy alertec without prescription
buy zyban without prescription
buy serax without prescription
buy medazepam without prescription
buy imovane without prescription
mefenorex for sale
lormetazepam for sale
prednisone for sale
ativan for sale
buy alprazolam without prescription
buy camazepam without prescription
buy nobrium without prescription
mazindol for sale
buy mazindol without prescription
buy mogadon without prescription
buy terbinafine without prescription
diazepam for sale
buy topamax without prescription
cialis for sale
buy tafil-xanor without prescription
buy librium without prescription
buy zithromax without prescription
retin-a for sale
buy lunesta without prescription
serax for sale
restoril for sale
stilnox for sale
lamotrigine for sale

Apache2 gzip compression: How do I speed up my website download time?


One of the things people tend to forget is the ability for web servers to compress content before sending it back to client. Client’s browser then uncompresses the data and displays it to the user. Pretty much all of the recent browsers support gzip compression. In this post, I will go over how to setup apache2 to use compression. First let’s see if your Apache installation has “deflate” enabled. You can check to see if you have deflate by typing:

# /usr/local/apache2/bin/apachectl -t -D DUMP_MODULES
Loaded Modules:
...
deflate_module (static)
...
Syntax OK

If you don’t have have deflate_module, you would have to recompile your apache with “–enable-deflate” option.

Going forward, I am going to assume you have deflate_module. Add the following to your apache conf file:

<Location />
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4\.0[678] no-gzip\
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
</Location>

The main thing you need to configure is the line which says “no-gzip dont-vary” also in bold above. This tells apache to not compress certain type of files. I have noticed on some of my sites that swf (flash) files do not work as expected if they are compressed. So if you have swf files in your site, you may want to add |swf right after png.

This is all what it takes for you to enable gzip compression in Apache2. Once you restart your apache so it reads the conf file, you can test if your site is getting compressed or not by using this tool: http://www.gidnetwork.com/tools/gzip-test.php

Here are the results for my blog:

Results for: http://crazytoon.com
Web page compressed? Yes
Compression type? gzip
Size, Markup (bytes) 57,337
Size, Compressed (bytes) 11,666
Compression % 79.7

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.


11 Responses to “ Apache2 gzip compression: How do I speed up my website download time? ”

  1. May 29th, 2008 | 10:27 am

    Even though on-the-fly compression will help you in the short term, you’ll soon hit CPU limits if your site will start to grow.

    We stricly use gzip for pages which can be cached for a couple of minutes, pre-generate the pages pre-compressing them. So those pages will only be compressed every 5 minutes or so instead of for every request.

  2. Freddy
    May 29th, 2008 | 10:52 am

    Just remember that the mod_deflate rules are virtualhost specific! They are NOT system wide.

    Evert is also somewhat correct BUT with todays 8core cpus memory management is where you have to worry the most not cpu on a apache server.

  3. Toasty
    May 30th, 2008 | 1:10 am

    Freddy, when you say memory management is ‘where you have to worry’, what do you mean specifically? Do you just mean running out of memory (and having to swap) or something else like being limited by internal RAMCPU bandwidth?

    Plus you do still have to worry a lot about CPU these days if you’re doing anything reasonably complex/dynamic.

  4. May 30th, 2008 | 7:08 am

    8 cores just mean it takes longer before you hits this bottleneck, so thats a non-argument. For low-traffic sites, such as a blog, its of course fine =)

  5. October 14th, 2009 | 12:32 pm

    [...] on google how I could enable GZip compression for all files through a .htaccess file and found this. Though this person said don’t enable it on images and also not on flash as that might make [...]

  6. June 16th, 2010 | 12:25 am

    thank you very mach..

  7. December 2nd, 2010 | 4:42 am

    Thanks for the advice, I ended up using Gzip also.

  8. March 3rd, 2011 | 1:46 pm

    [...] Apache2 gzip compression: How do I speed up my website download time? Enable GZIP compression in tomcat GZip compression [...]

  9. June 23rd, 2011 | 6:19 am

    most internet providers now have compression settings.

  10. February 1st, 2014 | 1:29 pm

    I wanted to thank you for this very good read!!
    I certainly loved every little bit of it.
    I have got you saved as a favorite to check out new things
    you post…

  11. February 13th, 2014 | 5:57 am

    Wonderful site. Plenty of helpful information
    here. I’m sending it to several buddies ans additionally sharing
    in delicious. And obviously, thanks for your effort!

Leave a reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image