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__"
20 SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
21 SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
23 # This syntax allows you to override a system preference
24 # for a given virtual host. Use with caution!
25 # You should add all the system preferences you override
26 # in one or more vhosts to the environment variable
27 # OVERRIDE_SYSPREF_NAMES for your staff intranet vhost
28 # SetEnv OVERRIDE_SYSPREF_PrefName Value
30 <Directory "__OPAC_WWW_DIR__">
34 # Secure internal stuff
35 <DirectoryMatch "__OPAC_WWW_DIR__/.*/(modules|xslt|includes)">
43 mod_gzip_keep_workfiles No
44 mod_gzip_can_negotiate yes
45 mod_gzip_update_static No
46 mod_gzip_temp_dir /tmp
47 mod_gzip_minimum_file_size 512
48 mod_gzip_maximum_file_size 1000000
49 mod_gzip_maximum_inmem_size 1000000
50 mod_gzip_handle_methods GET POST
51 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
52 mod_gzip_item_exclude mime ^image/.*
53 mod_gzip_item_exclude rspheader Content-Type:image/*
54 mod_gzip_item_include file \.js$
55 mod_gzip_item_include mime ^application/javascript$
56 mod_gzip_item_include mime ^application/x-javascript$
57 mod_gzip_item_include file \.php$
58 mod_gzip_item_include mime ^text/html$
59 mod_gzip_item_include file \.css$
60 mod_gzip_item_include mime ^text/css$
63 <IfModule mod_deflate.c>
65 # Compress content with type html, text, and css, ...
66 AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
67 AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
69 DeflateCompressionLevel 9
71 # Properly handle old browsers that do not support compression
72 BrowserMatch ^Mozilla/4 gzip-only-text/html
73 BrowserMatch ^Mozilla/4\.0[678] no-gzip
74 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
76 DeflateFilterNote Input instream
77 DeflateFilterNote Output outstream
78 DeflateFilterNote Ratio ratio
80 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
81 <IfModule mod_headers.c>
82 #properly handle requests coming from behind proxies
83 Header append Vary User-Agent
88 # Repeat this virtualhost stanza changing the following environment vars to
89 # create multiple OPAC interfaces with custom css and/or search limits:
90 # SetEnv OPAC_CSS_OVERRIDE mystyle.css
91 # SetEnv OPAC_SEARCH_LIMIT branch:CODE
92 # SetEnv OPAC_LIMIT_OVERRIDE 1
94 Options +FollowSymLinks
96 ErrorDocument 400 /cgi-bin/koha/errors/400.pl
97 ErrorDocument 401 /cgi-bin/koha/errors/401.pl
98 ErrorDocument 403 /cgi-bin/koha/errors/403.pl
99 ErrorDocument 404 /cgi-bin/koha/errors/404.pl
100 ErrorDocument 500 /cgi-bin/koha/errors/500.pl
102 <IfModule mod_rewrite.c>
106 # Uncomment to turn on rewrite logging
107 #RewriteLog __LOG_DIR__/koha-opac-rewrite.log
110 RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
111 #RewriteRule (.+) $1?%1%2 [N,R,NE]
112 RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
113 RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
114 RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
116 # REST API configuration
117 Alias "/api" "__API_CGI_DIR__"
118 <Directory __API_CGI_DIR__>
119 Options +ExecCGI +FollowSymlinks
120 AddHandler cgi-script .pl
122 SetEnv MOJO_MODE "production"
126 RewriteCond %{REQUEST_FILENAME} !-f
127 RewriteCond %{REQUEST_FILENAME} !-d
128 RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
129 RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
135 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
136 ServerAdmin __WEBMASTER_EMAIL__
137 DocumentRoot __INTRANET_WWW_DIR__
138 ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
139 # ServerAlias intranet.mydomain.com
140 ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
141 ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
142 ScriptAlias /search "__INTRANET_CGI_DIR__/search.pl"
143 Alias /plugin/ "__PLUGINS_DIR__/"
144 ErrorLog __LOG_DIR__/koha-error_log
145 # TransferLog __LOG_DIR__/koha-access.log
146 SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
147 SetEnv PERL5LIB "__PERL_MODULE_DIR__"
148 SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
149 SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
150 Options +FollowSymLinks
152 # If you are overriding any system preferences,
153 # list them in this variable so the preference editor
154 # knows that they have been overridden.
155 # SetEnv OVERRIDE_SYSPREF_NAMES "Pref1,Pref2,Pref3"
157 ErrorDocument 400 /cgi-bin/koha/errors/400.pl
158 ErrorDocument 401 /cgi-bin/koha/errors/401.pl
159 ErrorDocument 403 /cgi-bin/koha/errors/403.pl
160 ErrorDocument 404 /cgi-bin/koha/errors/404.pl
161 ErrorDocument 500 /cgi-bin/koha/errors/500.pl
163 <Directory "__INTRANET_WWW_DIR__">
167 # Secure internal stuff
168 <DirectoryMatch "__INTRANET_WWW_DIR__/.*/(modules|xslt|includes)">
173 <IfModule mod_gzip.c>
176 mod_gzip_keep_workfiles No
177 mod_gzip_can_negotiate yes
178 mod_gzip_update_static No
179 mod_gzip_temp_dir /tmp
180 mod_gzip_minimum_file_size 512
181 mod_gzip_maximum_file_size 1000000
182 mod_gzip_maximum_inmem_size 1000000
183 mod_gzip_handle_methods GET POST
184 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
185 mod_gzip_item_exclude mime ^image/.*
186 mod_gzip_item_exclude rspheader Content-Type:image/*
187 mod_gzip_item_include file \.js$
188 mod_gzip_item_include mime ^application/javascript$
189 mod_gzip_item_include mime ^application/x-javascript$
190 mod_gzip_item_include file \.php$
191 mod_gzip_item_include mime ^text/html$
192 mod_gzip_item_include file \.css$
193 mod_gzip_item_include mime ^text/css$
196 <IfModule mod_deflate.c>
198 # Compress content with type html, text, and css, ...
199 AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
200 AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
202 DeflateCompressionLevel 9
204 # Properly handle old browsers that do not support compression
205 BrowserMatch ^Mozilla/4 gzip-only-text/html
206 BrowserMatch ^Mozilla/4\.0[678] no-gzip
207 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
209 DeflateFilterNote Input instream
210 DeflateFilterNote Output outstream
211 DeflateFilterNote Ratio ratio
213 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
214 <IfModule mod_headers.c>
215 #properly handle requests coming from behind proxies
216 Header append Vary User-Agent
220 <IfModule mod_rewrite.c>
224 # Uncomment to turn on rewrite logging
225 #RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
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]
235 # REST API configuration
236 Alias "/api" "__API_CGI_DIR__"
237 <Directory __API_CGI_DIR__>
238 Options +ExecCGI +FollowSymlinks
239 AddHandler cgi-script .pl
241 SetEnv MOJO_MODE "production"
245 RewriteCond %{REQUEST_FILENAME} !-f
246 RewriteCond %{REQUEST_FILENAME} !-d
247 RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
248 RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
253 # Uncomment this VirtualHost to enable API access through
254 # api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
255 #<VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
256 # ServerAdmin __WEBMASTER_EMAIL__
257 # DocumentRoot __INTRANET_CGI_DIR__/api
258 # ServerName api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
259 # SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
260 # SetEnv PERL5LIB "__PERL_MODULE_DIR__"
261 # ErrorLog __LOG_DIR__/koha-api-error_log
263 # <IfModule mod_rewrite.c>
264 # <Directory __API_CGI_DIR__>
265 # Options +ExecCGI +FollowSymlinks
266 # AddHandler cgi-script .pl
268 # SetEnv MOJO_MODE "production"
272 # RewriteRule ^api/(.*) $1 [L]
274 # RewriteCond %{REQUEST_FILENAME} !-f
275 # RewriteCond %{REQUEST_FILENAME} !-d
276 # RewriteCond %{DOCUMENT_ROOT}/$1/app.pl -f
277 # RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]