Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I looked at the other answers and those solutions did not help.

I am completely confused how to do this. I know almost nothing about apache nor how to use it and nearly all the article say write this but doesnt tell me where.

So far i have done this

# a2enmod deflate
Module deflate already enabled

Then i tried writing this in httpd.conf

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css

Then i wrote a longer version which involved deflate.c. After those didnt work i deleted them all and wrote the AddOutputFilterByType line in apache2/sites-enabled/000-default inside of

I used this to test

everytime it says no compression. I used another site but i could never compress. Also i restart the server everytime i save a file so what could be the problem and how do i enable this properly?

share|improve this question

Try adding the following to your Apache Site config after all the directory config.

Its got a few rules to handle browsers that struggle with gzip compressed web pages.

<Location />
# 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

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !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
share|improve this answer
This does work but i rather have a whitelist then a backlist. I figured out with mod_mono text/html, text/plaintext doesnt cover my outputted html. Do you know what might cover it? I think i can use the above for one of my currently hosted website. – acidzombie24 Jul 13 '10 at 5:47
Have you tried <Location /> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css </Location> – AddersUK Jul 13 '10 at 16:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.