Bug 17229: Check if patron is expired in CanItemBeReserved
[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
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
27
28    <Directory "__OPAC_WWW_DIR__">
29       Options -Indexes
30    </Directory>
31
32    # Secure internal stuff
33    <DirectoryMatch "__OPAC_WWW_DIR__/.*/(modules|xslt|includes)">
34       Require all denied
35    </DirectoryMatch>
36
37    <IfModule mod_gzip.c>
38      mod_gzip_on yes
39      mod_gzip_dechunk yes
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 ^application/x-javascript$
54      mod_gzip_item_include file \.php$
55      mod_gzip_item_include mime ^text/html$
56      mod_gzip_item_include file \.css$
57      mod_gzip_item_include mime ^text/css$
58   </IfModule>
59
60   <IfModule mod_deflate.c>
61
62     # Compress content with type html, text, and css, ...
63     AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
64     AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
65
66     DeflateCompressionLevel 9
67
68     # Properly handle old browsers that do not support compression
69     BrowserMatch ^Mozilla/4 gzip-only-text/html
70     BrowserMatch ^Mozilla/4\.0[678] no-gzip
71     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
72
73     DeflateFilterNote Input instream
74     DeflateFilterNote Output outstream
75     DeflateFilterNote Ratio ratio
76
77     LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
78     <IfModule mod_headers.c>
79        #properly handle requests coming from behind proxies
80        Header append Vary User-Agent
81     </IfModule>
82   </IfModule>
83
84
85 #  Repeat this virtualhost stanza changing the following environment vars to
86 #  create multiple OPAC interfaces with custom css and/or search limits:
87 #  SetEnv OPAC_CSS_OVERRIDE mystyle.css
88 #  SetEnv OPAC_SEARCH_LIMIT branch:CODE
89 #  SetEnv OPAC_LIMIT_OVERRIDE 1
90
91    Options +FollowSymLinks
92
93    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
94    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
95    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
96    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
97    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
98
99    <IfModule mod_rewrite.c>
100      # Rewrite Rules
101      RewriteEngine On
102
103      RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
104      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
105      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
106      RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
107
108      # REST API configuration
109      Alias "/api" "__API_CGI_DIR__"
110      <Directory __API_CGI_DIR__>
111        Options +ExecCGI +FollowSymlinks
112        AddHandler cgi-script .pl
113
114        SetEnv MOJO_MODE "production"
115
116        RewriteEngine On
117        RewriteBase /api/
118        RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
119        RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
120
121      </Directory>
122    </IfModule>
123
124    <IfModule mod_expires.c>
125       ExpiresActive on
126       ExpiresByType text/css "access plus 60 days"
127       ExpiresByType application/javascript "access plus 60 days"
128       ExpiresByType image/png "access plus 12 hours"
129       ExpiresByType image/gif "access plus 12 hours"
130    </IfModule>
131 </VirtualHost>
132
133 ## Intranet
134 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
135    ServerAdmin __WEBMASTER_EMAIL__
136    DocumentRoot __INTRANET_WWW_DIR__
137    ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
138 #  ServerAlias intranet.mydomain.com
139    ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
140    ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
141    ScriptAlias /search "__INTRANET_CGI_DIR__/catalogue/search.pl"
142    Alias /plugin/ "__PLUGINS_DIR__/"
143    ErrorLog __LOG_DIR__/koha-error_log
144 #  TransferLog __LOG_DIR__/koha-access.log
145    SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
146    SetEnv PERL5LIB "__PERL_MODULE_DIR__"
147    Options +FollowSymLinks
148
149    # If you are overriding any system preferences,
150    # list them in this variable so the preference editor
151    # knows that they have been overridden.
152    # SetEnv OVERRIDE_SYSPREF_NAMES "Pref1,Pref2,Pref3"
153
154    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
155    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
156    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
157    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
158    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
159
160    <Directory "__INTRANET_WWW_DIR__">
161       Options -Indexes
162    </Directory>
163
164    # Secure internal stuff
165    <DirectoryMatch "__INTRANET_WWW_DIR__/.*/(modules|xslt|includes)">
166       Require all denied
167    </DirectoryMatch>
168
169    <IfModule mod_gzip.c>
170      mod_gzip_on yes
171      mod_gzip_dechunk yes
172      mod_gzip_keep_workfiles No
173      mod_gzip_can_negotiate yes
174      mod_gzip_update_static No
175      mod_gzip_temp_dir /tmp
176      mod_gzip_minimum_file_size 512
177      mod_gzip_maximum_file_size 1000000
178      mod_gzip_maximum_inmem_size 1000000
179      mod_gzip_handle_methods GET POST
180      mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
181      mod_gzip_item_exclude mime ^image/.*
182      mod_gzip_item_exclude rspheader Content-Type:image/*
183      mod_gzip_item_include file \.js$
184      mod_gzip_item_include mime ^application/javascript$
185      mod_gzip_item_include mime ^application/x-javascript$
186      mod_gzip_item_include file \.php$
187      mod_gzip_item_include mime ^text/html$
188      mod_gzip_item_include file \.css$
189      mod_gzip_item_include mime ^text/css$
190    </IfModule>
191
192    <IfModule mod_deflate.c>
193
194      # Compress content with type html, text, and css, ...
195      AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
196      AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
197
198      DeflateCompressionLevel 9
199
200      # Properly handle old browsers that do not support compression
201      BrowserMatch ^Mozilla/4 gzip-only-text/html
202      BrowserMatch ^Mozilla/4\.0[678] no-gzip
203      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
204
205      DeflateFilterNote Input instream
206      DeflateFilterNote Output outstream
207      DeflateFilterNote Ratio ratio
208
209      LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
210      <IfModule mod_headers.c>
211        #properly handle requests coming from behind proxies
212        Header append Vary User-Agent
213      </IfModule>
214   </IfModule>
215
216    <IfModule mod_rewrite.c>
217      # Rewrite Rules
218      RewriteEngine On
219
220      RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/catalogue/detail.pl?biblionumber=$1 [PT]
221      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
222      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
223      RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
224
225
226      # REST API configuration
227      Alias "/api" "__API_CGI_DIR__"
228      <Directory __API_CGI_DIR__>
229        Options +ExecCGI +FollowSymlinks
230        AddHandler cgi-script .pl
231
232        SetEnv MOJO_MODE "production"
233
234        RewriteEngine On
235        RewriteBase /api/
236        RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
237        RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
238      </Directory>
239    </IfModule>
240
241    <IfModule mod_expires.c>
242       ExpiresActive on
243       ExpiresByType text/css "access plus 60 days"
244       ExpiresByType application/javascript "access plus 60 days"
245       ExpiresByType image/png "access plus 12 hours"
246       ExpiresByType image/gif "access plus 12 hours"
247    </IfModule>
248 </VirtualHost>
249
250 # Uncomment this VirtualHost to enable API access through
251 # api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
252 #<VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
253 #  ServerAdmin __WEBMASTER_EMAIL__
254 #  DocumentRoot __INTRANET_CGI_DIR__/api
255 #  ServerName api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
256 #  SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
257 #  SetEnv PERL5LIB "__PERL_MODULE_DIR__"
258 #  ErrorLog __LOG_DIR__/koha-api-error_log
259 #
260 #  <IfModule mod_rewrite.c>
261 #    <Directory __API_CGI_DIR__>
262 #      Options +ExecCGI +FollowSymlinks
263 #      AddHandler cgi-script .pl
264 #
265 #      SetEnv MOJO_MODE "production"
266 #
267 #      RewriteEngine on
268 #
269 #      RewriteRule ^api/(.*) $1 [L]
270 #
271 #      RewriteCond %{REQUEST_FILENAME} !-f
272 #      RewriteCond %{REQUEST_FILENAME} !-d
273 #      RewriteCond %{DOCUMENT_ROOT}/$1/app.pl -f
274 #      RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
275 #    </Directory>
276 #  </IfModule>
277 #</VirtualHost>