From ab45c8525d2e991657c64be40ceffd856d9c2a26 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sat, 7 Nov 2009 20:10:58 +1300 Subject: [PATCH] Enabling mod_gzip for apache 1.3 and mod_deflate for 2.0+ Patch courtesy of Pablo A. Bianchi --- etc/koha-httpd.conf | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/etc/koha-httpd.conf b/etc/koha-httpd.conf index eaf249ea7e..2c8dfa0232 100644 --- a/etc/koha-httpd.conf +++ b/etc/koha-httpd.conf @@ -17,6 +17,53 @@ SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml" SetEnv PERL5LIB "__PERL_MODULE_DIR__" + + mod_gzip_on yes + mod_gzip_dechunk yes + mod_gzip_keep_workfiles No + mod_gzip_can_negotiate yes + mod_gzip_update_static No + mod_gzip_temp_dir /tmp + mod_gzip_minimum_file_size 512 + mod_gzip_maximum_file_size 1000000 + mod_gzip_maximum_inmem_size 1000000 + mod_gzip_handle_methods GET POST + mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\[" + mod_gzip_item_exclude mime ^image/.* + mod_gzip_item_exclude rspheader Content-Type:image/* + mod_gzip_item_include file \.js$ + mod_gzip_item_include mime ^application/x-javascript$ + mod_gzip_item_include file \.php$ + mod_gzip_item_include mime ^text/html$ + mod_gzip_item_include file \.css$ + mod_gzip_item_include mime ^text/css$ + + + + + # Compress content with type html, text, and css, ... + AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css + AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript + + DeflateCompressionLevel 9 + + # Properly handle old browsers that do not support compression + BrowserMatch ^Mozilla/4 gzip-only-text/html + BrowserMatch ^Mozilla/4\.0[678] no-gzip + BrowserMatch \bMSIE !no-gzip !gzip-only-text/html + + DeflateFilterNote Input instream + DeflateFilterNote Output outstream + DeflateFilterNote Ratio ratio + + LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate + + #properly handle requests coming from behind proxies + Header append Vary User-Agent + + + + # Repeat this virtualhost stanza changing the following environment vars to # create multiple OPAC interfaces with custom css and/or search limits: # SetEnv OPAC_CSS_OVERRIDE mystyle.css @@ -66,6 +113,52 @@ ErrorDocument 404 /cgi-bin/koha/errors/404.pl ErrorDocument 500 /cgi-bin/koha/errors/500.pl + + mod_gzip_on yes + mod_gzip_dechunk yes + mod_gzip_keep_workfiles No + mod_gzip_can_negotiate yes + mod_gzip_update_static No + mod_gzip_temp_dir /tmp + mod_gzip_minimum_file_size 512 + mod_gzip_maximum_file_size 1000000 + mod_gzip_maximum_inmem_size 1000000 + mod_gzip_handle_methods GET POST + mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\[" + mod_gzip_item_exclude mime ^image/.* + mod_gzip_item_exclude rspheader Content-Type:image/* + mod_gzip_item_include file \.js$ + mod_gzip_item_include mime ^application/x-javascript$ + mod_gzip_item_include file \.php$ + mod_gzip_item_include mime ^text/html$ + mod_gzip_item_include file \.css$ + mod_gzip_item_include mime ^text/css$ + + + + + # Compress content with type html, text, and css, ... + AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css + AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript + + DeflateCompressionLevel 9 + + # Properly handle old browsers that do not support compression + BrowserMatch ^Mozilla/4 gzip-only-text/html + BrowserMatch ^Mozilla/4\.0[678] no-gzip + BrowserMatch \bMSIE !no-gzip !gzip-only-text/html + + DeflateFilterNote Input instream + DeflateFilterNote Output outstream + DeflateFilterNote Ratio ratio + + LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate + + #properly handle requests coming from behind proxies + Header append Vary User-Agent + + + RewriteEngine On # Uncomment to turn on rewrite logging # RewriteLog __LOG_DIR__/koha-intranet-rewrite.log -- 2.39.5