Bug 9683: Allow disable rewrite apache mod
[koha.git] / etc / koha-httpd.conf
1 # Koha Apache Configuration Directives
2
3 #NameVirtualHost *
4
5 ## OPAC
6 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
7    ServerAdmin  __WEBMASTER_EMAIL__
8    DocumentRoot __OPAC_WWW_DIR__
9    ServerName __WEBSERVER_HOST__
10 #  ServerAlias opac.mydomain.com
11    ScriptAlias /cgi-bin/koha/ "__OPAC_CGI_DIR__/opac/"
12    ScriptAlias /index.html "__OPAC_CGI_DIR__/opac/opac-main.pl"
13    ScriptAlias /opac-search.pl "__OPAC_CGI_DIR__/opac/opac-search.pl"
14    ScriptAlias /search "__OPAC_CGI_DIR__/opac/opac-search.pl"
15    ErrorLog __LOG_DIR__/koha-opac-error_log
16 #  CustomLog __LOG_DIR__/koha-opac-access.log combined
17 #  TransferLog __LOG_DIR__/koha-opac-access.log
18    SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
19    SetEnv PERL5LIB "__PERL_MODULE_DIR__"
20    SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
21    SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
22
23    <IfModule mod_gzip.c>
24      mod_gzip_on yes
25      mod_gzip_dechunk yes
26      mod_gzip_keep_workfiles No
27      mod_gzip_can_negotiate yes
28      mod_gzip_update_static No
29      mod_gzip_temp_dir /tmp
30      mod_gzip_minimum_file_size 512
31      mod_gzip_maximum_file_size 1000000
32      mod_gzip_maximum_inmem_size 1000000
33      mod_gzip_handle_methods GET POST
34      mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
35      mod_gzip_item_exclude mime ^image/.*
36      mod_gzip_item_exclude rspheader Content-Type:image/*
37      mod_gzip_item_include file \.js$
38      mod_gzip_item_include mime ^application/javascript$
39      mod_gzip_item_include mime ^application/x-javascript$
40      mod_gzip_item_include file \.php$
41      mod_gzip_item_include mime ^text/html$
42      mod_gzip_item_include file \.css$
43      mod_gzip_item_include mime ^text/css$
44   </IfModule>
45
46   <IfModule mod_deflate.c>
47
48     # Compress content with type html, text, and css, ...
49     AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
50     AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
51
52     DeflateCompressionLevel 9
53
54     # Properly handle old browsers that do not support compression
55     BrowserMatch ^Mozilla/4 gzip-only-text/html
56     BrowserMatch ^Mozilla/4\.0[678] no-gzip
57     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
58
59     DeflateFilterNote Input instream
60     DeflateFilterNote Output outstream
61     DeflateFilterNote Ratio ratio
62
63     LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
64     <IfModule mod_headers.c>
65        #properly handle requests coming from behind proxies
66        Header append Vary User-Agent
67     </IfModule>
68   </IfModule>
69
70
71 #  Repeat this virtualhost stanza changing the following environment vars to
72 #  create multiple OPAC interfaces with custom css and/or search limits:
73 #  SetEnv OPAC_CSS_OVERRIDE mystyle.css
74 #  SetEnv OPAC_SEARCH_LIMIT branch:CODE
75 #  SetEnv OPAC_LIMIT_OVERRIDE 1
76
77    Options +FollowSymLinks
78
79    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
80    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
81    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
82    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
83    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
84
85    <IfModule mod_rewrite.c>
86      # Rewrite Rules
87      RewriteEngine On
88
89      # Uncomment to turn on rewrite logging
90      #RewriteLog __LOG_DIR__/koha-opac-rewrite.log
91      #RewriteLogLevel 1
92
93      RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
94      #RewriteRule (.+) $1?%1%2 [N,R,NE]
95      RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
96      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
97      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
98    </IfModule>
99 </VirtualHost>
100
101 ## Intranet
102 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
103    ServerAdmin __WEBMASTER_EMAIL__
104    DocumentRoot __INTRANET_WWW_DIR__
105    ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
106 #  ServerAlias intranet.mydomain.com
107    ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
108    ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
109    ScriptAlias /search "__INTRANET_CGI_DIR__/search.pl"
110    Alias /plugin/ "__PLUGINS_DIR__/"
111    ErrorLog __LOG_DIR__/koha-error_log
112 #  TransferLog __LOG_DIR__/koha-access.log
113    SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
114    SetEnv PERL5LIB "__PERL_MODULE_DIR__"
115    SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
116    SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
117    Options +FollowSymLinks
118
119    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
120    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
121    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
122    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
123    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
124
125    <IfModule mod_gzip.c>
126      mod_gzip_on yes
127      mod_gzip_dechunk yes
128      mod_gzip_keep_workfiles No
129      mod_gzip_can_negotiate yes
130      mod_gzip_update_static No
131      mod_gzip_temp_dir /tmp
132      mod_gzip_minimum_file_size 512
133      mod_gzip_maximum_file_size 1000000
134      mod_gzip_maximum_inmem_size 1000000
135      mod_gzip_handle_methods GET POST
136      mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
137      mod_gzip_item_exclude mime ^image/.*
138      mod_gzip_item_exclude rspheader Content-Type:image/*
139      mod_gzip_item_include file \.js$
140      mod_gzip_item_include mime ^application/javascript$
141      mod_gzip_item_include mime ^application/x-javascript$
142      mod_gzip_item_include file \.php$
143      mod_gzip_item_include mime ^text/html$
144      mod_gzip_item_include file \.css$
145      mod_gzip_item_include mime ^text/css$
146    </IfModule>
147
148    <IfModule mod_deflate.c>
149
150      # Compress content with type html, text, and css, ...
151      AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
152      AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
153
154      DeflateCompressionLevel 9
155
156      # Properly handle old browsers that do not support compression
157      BrowserMatch ^Mozilla/4 gzip-only-text/html
158      BrowserMatch ^Mozilla/4\.0[678] no-gzip
159      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
160
161      DeflateFilterNote Input instream
162      DeflateFilterNote Output outstream
163      DeflateFilterNote Ratio ratio
164
165      LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
166      <IfModule mod_headers.c>
167        #properly handle requests coming from behind proxies
168        Header append Vary User-Agent
169      </IfModule>
170   </IfModule>
171
172    <IfModule mod_rewrite.c>
173      # Rewrite Rules
174      RewriteEngine On
175
176      # Uncomment to turn on rewrite logging
177      #RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
178      #RewriteLogLevel 1
179
180      RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
181      #RewriteRule (.+) $1?%1%2 [N,R,NE]
182      RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
183      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
184      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
185    </IfModule>
186 </VirtualHost>