0

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 http://www.whatsmyip.org/http_compression/

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?

1 Answers1

3

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
</Location>
AddersUK
  • 1,266
  • 1
  • 9
  • 4
  • 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. –  Jul 13 '10 at 05:47
  • 3
    Have you tried AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css – AddersUK Jul 13 '10 at 16:10