Bug 17332: Remove memcached config from apache files
[koha-equinox.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       Order deny,allow
35       Deny from all
36    </DirectoryMatch>
37
38    <IfModule mod_gzip.c>
39      mod_gzip_on yes
40      mod_gzip_dechunk yes
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$
59   </IfModule>
60
61   <IfModule mod_deflate.c>
62
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
66
67     DeflateCompressionLevel 9
68
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
73
74     DeflateFilterNote Input instream
75     DeflateFilterNote Output outstream
76     DeflateFilterNote Ratio ratio
77
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
82     </IfModule>
83   </IfModule>
84
85
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
91
92    Options +FollowSymLinks
93
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
99
100    <IfModule mod_rewrite.c>
101      # Rewrite Rules
102      RewriteEngine On
103
104      # Uncomment to turn on rewrite logging
105      #RewriteLog __LOG_DIR__/koha-opac-rewrite.log
106      #RewriteLogLevel 1
107
108      RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
109      #RewriteRule (.+) $1?%1%2 [N,R,NE]
110      RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
111      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
112      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
113
114      # REST API configuration
115      Alias "/api" "__API_CGI_DIR__"
116      <Directory __API_CGI_DIR__>
117        Options +ExecCGI +FollowSymlinks
118        AddHandler cgi-script .pl
119
120        SetEnv MOJO_MODE "production"
121
122        RewriteEngine On
123        RewriteBase /api/
124        RewriteCond %{REQUEST_FILENAME} !-f
125        RewriteCond %{REQUEST_FILENAME} !-d
126        RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
127        RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
128      </Directory>
129    </IfModule>
130 </VirtualHost>
131
132 ## Intranet
133 <VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT_LIBRARIAN__>
134    ServerAdmin __WEBMASTER_EMAIL__
135    DocumentRoot __INTRANET_WWW_DIR__
136    ServerName __WEBSERVER_HOST__:__WEBSERVER_PORT_LIBRARIAN__
137 #  ServerAlias intranet.mydomain.com
138    ScriptAlias /cgi-bin/koha/ "__INTRANET_CGI_DIR__/"
139    ScriptAlias /index.html "__INTRANET_CGI_DIR__/mainpage.pl"
140    ScriptAlias /search "__INTRANET_CGI_DIR__/catalogue/search.pl"
141    Alias /plugin/ "__PLUGINS_DIR__/"
142    ErrorLog __LOG_DIR__/koha-error_log
143 #  TransferLog __LOG_DIR__/koha-access.log
144    SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
145    SetEnv PERL5LIB "__PERL_MODULE_DIR__"
146    Options +FollowSymLinks
147
148    # If you are overriding any system preferences,
149    # list them in this variable so the preference editor
150    # knows that they have been overridden.
151    # SetEnv OVERRIDE_SYSPREF_NAMES "Pref1,Pref2,Pref3"
152
153    ErrorDocument 400 /cgi-bin/koha/errors/400.pl
154    ErrorDocument 401 /cgi-bin/koha/errors/401.pl
155    ErrorDocument 403 /cgi-bin/koha/errors/403.pl
156    ErrorDocument 404 /cgi-bin/koha/errors/404.pl
157    ErrorDocument 500 /cgi-bin/koha/errors/500.pl
158
159    <Directory "__INTRANET_WWW_DIR__">
160       Options -Indexes
161    </Directory>
162
163    # Secure internal stuff
164    <DirectoryMatch "__INTRANET_WWW_DIR__/.*/(modules|xslt|includes)">
165       Order deny,allow
166       Deny from all
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      # Uncomment to turn on rewrite logging
221      #RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
222      #RewriteLogLevel 1
223
224      RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
225      #RewriteRule (.+) $1?%1%2 [N,R,NE]
226      RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
227      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
228      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
229
230
231      # REST API configuration
232      Alias "/api" "__API_CGI_DIR__"
233      <Directory __API_CGI_DIR__>
234        Options +ExecCGI +FollowSymlinks
235        AddHandler cgi-script .pl
236
237        SetEnv MOJO_MODE "production"
238
239        RewriteEngine On
240        RewriteBase /api/
241        RewriteCond %{REQUEST_FILENAME} !-f
242        RewriteCond %{REQUEST_FILENAME} !-d
243        RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
244        RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
245      </Directory>
246    </IfModule>
247 </VirtualHost>
248
249 # Uncomment this VirtualHost to enable API access through
250 # api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
251 #<VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__>
252 #  ServerAdmin __WEBMASTER_EMAIL__
253 #  DocumentRoot __INTRANET_CGI_DIR__/api
254 #  ServerName api.__WEBSERVER_HOST__:__WEBSERVER_PORT__
255 #  SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
256 #  SetEnv PERL5LIB "__PERL_MODULE_DIR__"
257 #  ErrorLog __LOG_DIR__/koha-api-error_log
258 #
259 #  <IfModule mod_rewrite.c>
260 #    <Directory __API_CGI_DIR__>
261 #      Options +ExecCGI +FollowSymlinks
262 #      AddHandler cgi-script .pl
263 #
264 #      SetEnv MOJO_MODE "production"
265 #
266 #      RewriteEngine on
267 #
268 #      RewriteRule ^api/(.*) $1 [L]
269 #
270 #      RewriteCond %{REQUEST_FILENAME} !-f
271 #      RewriteCond %{REQUEST_FILENAME} !-d
272 #      RewriteCond %{DOCUMENT_ROOT}/$1/app.pl -f
273 #      RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
274 #    </Directory>
275 #  </IfModule>
276 #</VirtualHost>