1 # Koha Apache Configuration Directives
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__"
21 # This syntax allows you to override a system preference
22 # for a given virtual host. Use with caution!
23 # You should add all the system preferences you override
24 # in one or more vhosts to the environment variable
25 # OVERRIDE_SYSPREF_NAMES for your staff intranet vhost
26 # SetEnv OVERRIDE_SYSPREF_PrefName Value
28 <Directory "__OPAC_WWW_DIR__">
32 # Secure internal stuff
33 <DirectoryMatch "__OPAC_WWW_DIR__/.*/(modules|xslt|includes)">
41 mod_gzip_keep_workfiles No
42 mod_gzip_can_negotiate yes
43 mod_gzip_update_static No
44 mod_gzip_temp_dir /tmp
45 mod_gzip_minimum_file_size 512
46 mod_gzip_maximum_file_size 1000000
47 mod_gzip_maximum_inmem_size 1000000
48 mod_gzip_handle_methods GET POST
49 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
50 mod_gzip_item_exclude mime ^image/.*
51 mod_gzip_item_exclude rspheader Content-Type:image/*
52 mod_gzip_item_include file \.js$
53 mod_gzip_item_include mime ^application/javascript$
54 mod_gzip_item_include mime ^application/x-javascript$
55 mod_gzip_item_include file \.php$
56 mod_gzip_item_include mime ^text/html$
57 mod_gzip_item_include file \.css$
58 mod_gzip_item_include mime ^text/css$
61 <IfModule mod_deflate.c>
63 # Compress content with type html, text, and css, ...
64 AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
65 AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
67 DeflateCompressionLevel 9
69 # Properly handle old browsers that do not support compression
70 BrowserMatch ^Mozilla/4 gzip-only-text/html
71 BrowserMatch ^Mozilla/4\.0[678] no-gzip
72 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
74 DeflateFilterNote Input instream
75 DeflateFilterNote Output outstream
76 DeflateFilterNote Ratio ratio
78 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
79 <IfModule mod_headers.c>
80 #properly handle requests coming from behind proxies
81 Header append Vary User-Agent
86 # Repeat this virtualhost stanza changing the following environment vars to
87 # create multiple OPAC interfaces with custom css and/or search limits:
88 # SetEnv OPAC_CSS_OVERRIDE mystyle.css
89 # SetEnv OPAC_SEARCH_LIMIT branch:CODE
90 # SetEnv OPAC_LIMIT_OVERRIDE 1
92 Options +FollowSymLinks
94 ErrorDocument 400 /cgi-bin/koha/errors/400.pl
95 ErrorDocument 401 /cgi-bin/koha/errors/401.pl
96 ErrorDocument 403 /cgi-bin/koha/errors/403.pl
97 ErrorDocument 404 /cgi-bin/koha/errors/404.pl
98 ErrorDocument 500 /cgi-bin/koha/errors/500.pl
100 <IfModule mod_rewrite.c>
104 # Uncomment to turn on rewrite logging
105 #RewriteLog __LOG_DIR__/koha-opac-rewrite.log
108 #The following two directives are unnecessary to proper Koha functioning.
109 #RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
110 #RewriteRule (.+) $1?%1%2 [N,R,NE]
111 RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
112 RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
113 RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
114 RewriteRule ^(.*)_(.*).js$ $1.js [N,L]
115 RewriteRule ^(.*)_(.*).css$ $1.css [N,L]
117 # REST API configuration
118 Alias "/api" "__API_CGI_DIR__"
119 <Directory __API_CGI_DIR__>
120 Options +ExecCGI +FollowSymlinks
121 AddHandler cgi-script .pl
123 SetEnv MOJO_MODE "production"
127 RewriteCond %{REQUEST_FILENAME} !-f
128 RewriteCond %{REQUEST_FILENAME} !-d
129 RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
130 RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
136 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
137 ServerAdmin __WEBMASTER_EMAIL__
138 DocumentRoot __INTRANET_WWW_DIR__
139 ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
140 # ServerAlias intranet.mydomain.com
141 ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
142 ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
143 ScriptAlias /search "__INTRANET_CGI_DIR__/catalogue/search.pl"
144 Alias /plugin/ "__PLUGINS_DIR__/"
145 ErrorLog __LOG_DIR__/koha-error_log
146 # TransferLog __LOG_DIR__/koha-access.log
147 SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
148 SetEnv PERL5LIB "__PERL_MODULE_DIR__"
149 Options +FollowSymLinks
151 # If you are overriding any system preferences,
152 # list them in this variable so the preference editor
153 # knows that they have been overridden.
154 # SetEnv OVERRIDE_SYSPREF_NAMES "Pref1,Pref2,Pref3"
156 ErrorDocument 400 /cgi-bin/koha/errors/400.pl
157 ErrorDocument 401 /cgi-bin/koha/errors/401.pl
158 ErrorDocument 403 /cgi-bin/koha/errors/403.pl
159 ErrorDocument 404 /cgi-bin/koha/errors/404.pl
160 ErrorDocument 500 /cgi-bin/koha/errors/500.pl
162 <Directory "__INTRANET_WWW_DIR__">
166 # Secure internal stuff
167 <DirectoryMatch "__INTRANET_WWW_DIR__/.*/(modules|xslt|includes)">
172 <IfModule mod_gzip.c>
175 mod_gzip_keep_workfiles No
176 mod_gzip_can_negotiate yes
177 mod_gzip_update_static No
178 mod_gzip_temp_dir /tmp
179 mod_gzip_minimum_file_size 512
180 mod_gzip_maximum_file_size 1000000
181 mod_gzip_maximum_inmem_size 1000000
182 mod_gzip_handle_methods GET POST
183 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
184 mod_gzip_item_exclude mime ^image/.*
185 mod_gzip_item_exclude rspheader Content-Type:image/*
186 mod_gzip_item_include file \.js$
187 mod_gzip_item_include mime ^application/javascript$
188 mod_gzip_item_include mime ^application/x-javascript$
189 mod_gzip_item_include file \.php$
190 mod_gzip_item_include mime ^text/html$
191 mod_gzip_item_include file \.css$
192 mod_gzip_item_include mime ^text/css$
195 <IfModule mod_deflate.c>
197 # Compress content with type html, text, and css, ...
198 AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
199 AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
201 DeflateCompressionLevel 9
203 # Properly handle old browsers that do not support compression
204 BrowserMatch ^Mozilla/4 gzip-only-text/html
205 BrowserMatch ^Mozilla/4\.0[678] no-gzip
206 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
208 DeflateFilterNote Input instream
209 DeflateFilterNote Output outstream
210 DeflateFilterNote Ratio ratio
212 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
213 <IfModule mod_headers.c>
214 #properly handle requests coming from behind proxies
215 Header append Vary User-Agent
219 <IfModule mod_rewrite.c>
223 # Uncomment to turn on rewrite logging
224 #RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
227 #The following two directives are unnecessary to proper Koha functioning.
228 #RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
229 #RewriteRule (.+) $1?%1%2 [N,R,NE]
230 RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
231 RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
232 RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
233 RewriteRule ^(.*)_(.*).js$ $1.js [N,L]
234 RewriteRule ^(.*)_(.*).css$ $1.css [N,L]
237 # REST API configuration
238 Alias "/api" "__API_CGI_DIR__"
239 <Directory __API_CGI_DIR__>
240 Options +ExecCGI +FollowSymlinks
241 AddHandler cgi-script .pl
243 SetEnv MOJO_MODE "production"
247 RewriteCond %{REQUEST_FILENAME} !-f
248 RewriteCond %{REQUEST_FILENAME} !-d
249 RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
250 RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
255 # Uncomment this VirtualHost to enable API access through
256 # api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
257 #<VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
258 # ServerAdmin __WEBMASTER_EMAIL__
259 # DocumentRoot __INTRANET_CGI_DIR__/api
260 # ServerName api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
261 # SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
262 # SetEnv PERL5LIB "__PERL_MODULE_DIR__"
263 # ErrorLog __LOG_DIR__/koha-api-error_log
265 # <IfModule mod_rewrite.c>
266 # <Directory __API_CGI_DIR__>
267 # Options +ExecCGI +FollowSymlinks
268 # AddHandler cgi-script .pl
270 # SetEnv MOJO_MODE "production"
274 # RewriteRule ^api/(.*) $1 [L]
276 # RewriteCond %{REQUEST_FILENAME} !-f
277 # RewriteCond %{REQUEST_FILENAME} !-d
278 # RewriteCond %{DOCUMENT_ROOT}/$1/app.pl -f
279 # RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]