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 "__PERL5LIB_DIRS__"
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)">
40 mod_gzip_keep_workfiles No
41 mod_gzip_can_negotiate yes
42 mod_gzip_update_static No
43 mod_gzip_temp_dir /tmp
44 mod_gzip_minimum_file_size 512
45 mod_gzip_maximum_file_size 1000000
46 mod_gzip_maximum_inmem_size 1000000
47 mod_gzip_handle_methods GET POST
48 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
49 mod_gzip_item_exclude mime ^image/.*
50 mod_gzip_item_exclude rspheader Content-Type:image/*
51 mod_gzip_item_include file \.js$
52 mod_gzip_item_include mime ^application/javascript$
53 mod_gzip_item_include mime ^text/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
66 AddOutputFilterByType DEFLATE application/javascript text/javascript application/x-javascript application/json
68 DeflateCompressionLevel 9
70 # Properly handle old browsers that do not support compression
71 BrowserMatch ^Mozilla/4 gzip-only-text/html
72 BrowserMatch ^Mozilla/4\.0[678] no-gzip
73 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
75 DeflateFilterNote Input instream
76 DeflateFilterNote Output outstream
77 DeflateFilterNote Ratio ratio
79 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
80 <IfModule mod_headers.c>
81 #properly handle requests coming from behind proxies
82 Header append Vary User-Agent
87 # Repeat this virtualhost stanza changing the following environment vars to
88 # create multiple OPAC interfaces with custom css and/or search limits:
89 # SetEnv OPAC_CSS_OVERRIDE mystyle.css
90 # SetEnv OPAC_SEARCH_LIMIT branch:CODE
91 # SetEnv OPAC_LIMIT_OVERRIDE 1
93 Options +FollowSymLinks
95 ErrorDocument 400 /cgi-bin/koha/errors/400.pl
96 ErrorDocument 401 /cgi-bin/koha/errors/401.pl
97 ErrorDocument 403 /cgi-bin/koha/errors/403.pl
98 ErrorDocument 404 /cgi-bin/koha/errors/404.pl
99 ErrorDocument 500 /cgi-bin/koha/errors/500.pl
101 <IfModule mod_rewrite.c>
105 RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
106 RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
107 RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
108 RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
110 RewriteRule ^/cgi-bin/koha/erm/.*$ /cgi-bin/koha/erm/erm.pl [PT]
111 RewriteRule ^/cgi-bin/koha/preservation/.*$ /cgi-bin/koha/preservation/home.pl [PT]
113 # REST API configuration
114 Alias "/api" "__API_CGI_DIR__"
115 <Directory __API_CGI_DIR__>
116 Options +ExecCGI +FollowSymlinks
117 AddHandler cgi-script .pl
119 SetEnv MOJO_MODE "production"
123 RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
124 RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
129 <IfModule mod_expires.c>
131 ExpiresByType text/css "access plus 60 days"
132 ExpiresByType application/javascript "access plus 60 days"
133 ExpiresByType image/png "access plus 12 hours"
134 ExpiresByType image/gif "access plus 12 hours"
139 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
140 ServerAdmin __WEBMASTER_EMAIL__
141 DocumentRoot __INTRANET_WWW_DIR__
142 ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
143 # ServerAlias intranet.mydomain.com
144 ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
145 ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
146 ScriptAlias /search "__INTRANET_CGI_DIR__/catalogue/search.pl"
147 Alias /plugin/ "__PLUGINS_DIR__/"
148 ErrorLog __LOG_DIR__/koha-error_log
149 # TransferLog __LOG_DIR__/koha-access.log
150 SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
151 SetEnv PERL5LIB "__PERL5LIB_DIRS__"
152 Options +FollowSymLinks
154 # If you are overriding any system preferences,
155 # list them in this variable so the preference editor
156 # knows that they have been overridden.
157 # SetEnv OVERRIDE_SYSPREF_NAMES "Pref1,Pref2,Pref3"
159 ErrorDocument 400 /cgi-bin/koha/errors/400.pl
160 ErrorDocument 401 /cgi-bin/koha/errors/401.pl
161 ErrorDocument 403 /cgi-bin/koha/errors/403.pl
162 ErrorDocument 404 /cgi-bin/koha/errors/404.pl
163 ErrorDocument 500 /cgi-bin/koha/errors/500.pl
165 <Directory "__INTRANET_WWW_DIR__">
169 # Secure internal stuff
170 <DirectoryMatch "__INTRANET_WWW_DIR__/.*/(modules|xslt|includes)">
172 <FilesMatch "\.(json)$">
177 <IfModule mod_gzip.c>
180 mod_gzip_keep_workfiles No
181 mod_gzip_can_negotiate yes
182 mod_gzip_update_static No
183 mod_gzip_temp_dir /tmp
184 mod_gzip_minimum_file_size 512
185 mod_gzip_maximum_file_size 1000000
186 mod_gzip_maximum_inmem_size 1000000
187 mod_gzip_handle_methods GET POST
188 mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
189 mod_gzip_item_exclude mime ^image/.*
190 mod_gzip_item_exclude rspheader Content-Type:image/*
191 mod_gzip_item_include file \.js$
192 mod_gzip_item_include mime ^application/javascript$
193 mod_gzip_item_include mime ^text/javascript$
194 mod_gzip_item_include mime ^application/x-javascript$
195 mod_gzip_item_include file \.php$
196 mod_gzip_item_include mime ^text/html$
197 mod_gzip_item_include file \.css$
198 mod_gzip_item_include mime ^text/css$
201 <IfModule mod_deflate.c>
203 # Compress content with type html, text, and css, ...
204 AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
205 AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
206 AddOutputFilterByType DEFLATE application/javascript text/javascript application/x-javascript application/json
208 DeflateCompressionLevel 9
210 # Properly handle old browsers that do not support compression
211 BrowserMatch ^Mozilla/4 gzip-only-text/html
212 BrowserMatch ^Mozilla/4\.0[678] no-gzip
213 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
215 DeflateFilterNote Input instream
216 DeflateFilterNote Output outstream
217 DeflateFilterNote Ratio ratio
219 LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
220 <IfModule mod_headers.c>
221 #properly handle requests coming from behind proxies
222 Header append Vary User-Agent
226 <IfModule mod_rewrite.c>
230 RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/catalogue/detail.pl?biblionumber=$1 [PT]
231 RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
232 RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
233 RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
236 # REST API configuration
237 Alias "/api" "__API_CGI_DIR__"
238 <Directory __API_CGI_DIR__>
239 Options +ExecCGI +FollowSymlinks
240 AddHandler cgi-script .pl
242 SetEnv MOJO_MODE "production"
246 RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
247 RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
251 <IfModule mod_expires.c>
253 ExpiresByType text/css "access plus 60 days"
254 ExpiresByType application/javascript "access plus 60 days"
255 ExpiresByType image/png "access plus 12 hours"
256 ExpiresByType image/gif "access plus 12 hours"
260 # Uncomment this VirtualHost to enable API access through
261 # api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
262 #<VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
263 # ServerAdmin __WEBMASTER_EMAIL__
264 # DocumentRoot __INTRANET_CGI_DIR__/api
265 # ServerName api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
266 # SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
267 # SetEnv PERL5LIB "__PERL5LIB_DIRS__"
268 # ErrorLog __LOG_DIR__/koha-api-error_log
270 # <IfModule mod_rewrite.c>
271 # <Directory __API_CGI_DIR__>
272 # Options +ExecCGI +FollowSymlinks
273 # AddHandler cgi-script .pl
275 # SetEnv MOJO_MODE "production"
279 # RewriteRule ^api/(.*) $1 [L]
281 # RewriteCond %{REQUEST_FILENAME} !-f
282 # RewriteCond %{REQUEST_FILENAME} !-d
283 # RewriteCond %{DOCUMENT_ROOT}/$1/app.pl -f
284 # RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]