Apache2 configuration to deflate all content
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 2 Nov 2009 15:39:50 +0000 (15:39 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 2 Nov 2009 15:39:50 +0000 (15:39 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@154 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/apache2/deflate.conf [new file with mode: 0644]

diff --git a/recepies/apache2/deflate.conf b/recepies/apache2/deflate.conf
new file mode 100644 (file)
index 0000000..ecfa0df
--- /dev/null
@@ -0,0 +1,20 @@
+# /etc/apache2/conf.d/deflate.conf
+
+<IfModule mod_deflate.c>
+       AddOutputFilterByType DEFLATE text/html text/plain text/xml
+
+       SetOutputFilter DEFLATE
+       SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$                         no-gzip dont-vary
+       SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$      no-gzip dont-vary
+       SetEnvIfNoCase Request_URI \.pdf$                                                       no-gzip dont-vary
+
+       BrowserMatch ^Mozilla/4 gzip-only-text/html
+       BrowserMatch ^Mozilla/4\.0[678] no-gzip
+       BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+
+       DeflateFilterNote Input input_info
+       DeflateFilterNote Output output_info
+       DeflateFilterNote Ratio ratio_info
+       LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
+       CustomLog /var/log/apache2/deflate.log deflate
+</IfModule>