Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 am trying to make the webserver in Snow Leopard compress all output by default. The only thing I have found is to add SetOutputFilter DEFLATE in the .htaccess file for a directory.

I really don't want to add an .htaccess file to every directory served.

How can I globally get Apache2 on Snow Leopard to compress output?

share|improve this question

Add the output filter to the configure file (make sure you have Server Admin closed) /etc/apache2/httpd.conf.

If you're using virtual hosts you can do it on a per-domain-basis inside /etc/apache2/sites/.

share|improve this answer
Where do I add the line so that it is global to all pages, directories and sites? I tried adding to the end of the file, but no go. – gbrandt Mar 23 '10 at 15:58

I put this in /etc/apache2/other/deflate.conf (which I created):

AddOutputFilterByType DEFLATE text/html text/xml text/css application/javascript application/xml+xhtml

After adding this file, or adding this directive to httpd.conf, you have to restart Apache. In, you can do 'sudo apachectl restart' to accomplish this.

You don't want to do a blanket 'AddOutputFilter DEFLATE' because then the server will try to compress all files, including files that are already compressed - JPEG images, PNGs, video/movie files, MP3s, etc. - which will make it much slower to serve those files.

share|improve this answer

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.