]> git.openstreetmap.org Git - chef.git/blob - cookbooks/nominatim/templates/default/apache.erb
nominatim: empty default for redirects
[chef.git] / cookbooks / nominatim / templates / default / apache.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <% [80, 443].each do |port| -%>
4 <VirtualHost *:<%= port %>>
5     ServerName <%= node[:fqdn] %>
6     ServerAlias nominatim.openstreetmap.org
7     ServerAlias nominatim.osm.org
8     ServerAlias nominatim.openstreetmap.org
9     ServerAlias nominatim.openstreetmap.net
10     ServerAlias nominatim.openstreetmaps.org
11     ServerAlias nominatim.openmaps.org
12     ServerAdmin webmaster@openstreetmap.org
13
14 <% if port == 443 -%>
15     #
16     # Enable SSL
17     #
18     SSLEngine on
19 <% end -%>
20
21     CustomLog /var/log/apache2/nominatim.openstreetmap.org-access.log combined
22     ErrorLog /var/log/apache2/nominatim.openstreetmap.org-error.log
23
24     DocumentRoot <%= @directory %>/website
25     <Directory "<%= @directory %>/website/">
26         DirectoryIndex search.php
27         Options FollowSymLinks
28         Require all granted
29     </Directory>
30
31     ProxyPassMatch ^/([^/]*\.php(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%><%= @directory %>/website/$1
32
33     <% @pools.each do |name,details| -%>
34     Alias /pool-<%= name %>/ "<%= @directory %>/website/"
35     <% node[:nominatim][:redirects].each do |url,host| -%>
36     ProxyPassMatch ^/pool-<%= name %>/(<%= url %>\.php(/.*)?) http<% if port == 443 -%>s<% end -%>://<%= host %>/pool-<%= name %>/$1
37     <% end -%>
38     ProxyPassMatch ^/pool-<%= name %>/(.*\.php(/.*)?) fcgi://127.0.0.1:<%= details[:port ]%><%= @directory %>/website/$1
39     <% end -%>
40
41     Redirect 429 /pool-block/
42     ErrorDocument 429 /509.html
43     <Location /pool-block>
44         ErrorDocument 429 /509.html
45     </Location>
46     Redirect 403 /pool-ban/
47     <Location /pool-ban>
48         ErrorDocument 403 /403.html
49     </Location>
50     ErrorDocument 403 /403.html
51
52     RewriteEngine On
53
54     # manual blocks
55     Include <%= @directory %>/settings/apache_blocks.conf
56
57     # regular requests and autoblocks
58     RewriteMap bulklist txt:<%= @directory %>/settings/ip_blocks.map
59     RewriteRule ^/(search|reverse|details)(\.php)?(/.*)? /pool-${bulklist:%{REMOTE_ADDR}|www}/$1.php$3 [PT]
60
61 </VirtualHost>
62
63 <% end -%>