]> git.openstreetmap.org Git - chef.git/blob - cookbooks/nominatim/templates/default/apache.erb
move nominatim traffic back to poldi
[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     SSLProxyEngine on
20 <% end -%>
21
22     CustomLog /var/log/apache2/nominatim.openstreetmap.org-access.log combined
23     ErrorLog /var/log/apache2/nominatim.openstreetmap.org-error.log
24
25     DocumentRoot <%= @directory %>/website
26     <Directory "<%= @directory %>/website/">
27         DirectoryIndex search.php
28         Options FollowSymLinks
29         Require all granted
30     </Directory>
31
32     ProxyPassMatch ^/([^/]*\.php(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%><%= @directory %>/website/$1
33
34     <% @pools.each do |name,details| -%>
35     Alias /pool-<%= name %>/ "<%= @directory %>/website/"
36     <% end -%>
37     <% node[:nominatim][:redirects].each do |url,host| -%>
38     ProxyPassMatch ^/pool-www/(<%= url %>\.php(/.*)?) http<% if port == 443 -%>s<% end -%>://<%= host %>/pool-www/$1
39     <% end -%>
40     <% @pools.each do |name,details| -%>
41     ProxyPassMatch ^/pool-<%= name %>/(.*\.php(/.*)?) fcgi://127.0.0.1:<%= details[:port ]%><%= @directory %>/website/$1
42     <% end -%>
43
44     Redirect 429 /pool-block/
45     ErrorDocument 429 /509.html
46     <Location /pool-block>
47         ErrorDocument 429 /509.html
48     </Location>
49     Redirect 403 /pool-ban/
50     <Location /pool-ban>
51         ErrorDocument 403 /403.html
52     </Location>
53     ErrorDocument 403 /403.html
54
55     RewriteEngine On
56
57     # manual blocks
58     Include <%= @directory %>/settings/apache_blocks.conf
59
60     # regular requests and autoblocks
61     RewriteMap bulklist txt:<%= @directory %>/settings/ip_blocks.map
62     RewriteRule ^/(search|reverse|details|lookup)(\.php)?(/.*)? /pool-${bulklist:%{REMOTE_ADDR}|www}/$1.php$3 [PT]
63
64 </VirtualHost>
65
66 <% end -%>