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?
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/.
I put this in /etc/apache2/other/deflate.conf (which I created):
After adding this file, or adding this directive to httpd.conf, you have to restart Apache. In Terminal.app, 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.