How to enable output compression in apache

What is deflate: deflate is apache module, that main task is to compress all the output before serving or sending to browser.

How browser handle this compression : Most of the browser are very much expert ,so they can handle this easily . The main technique is , apache will send the output in compressed format, after receiving this output browser will uncompress it and render the formated output.

How to enable: 1. Open a new terminal and give this command.
2. sudo a2enmod deflate

3. create new file called deflate.conf in your apache conf.d folder. and paste the following code:

[code]

# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary

[/code]

save the file.

4. sudo /etc/init.d/apache2 restart

Note: Please check your apache module,if you have not enabled header module of apache,

you must remove the line “Header append Vary User-Agent env=!dont-vary” from deflate.conf .

4 Responses to “How to enable output compression in apache”

  1. It’s a interesting point of view and I’m not sure if most people will agree with it, but then again, everyone is entitled to an opinion.

  2. this post is very usefull thx!

  3. Your url you mailed me came thru, thanks, but it seems to not be working, does anybody at all have a backup, or mirror source? Just something that works.

Leave a Reply

Your email address will not be published.