]> git.openstreetmap.org Git - chef.git/blob - cookbooks/nominatim/templates/default/apache.erb
1c8c82f7d22683b0c0bc58066c1872b6dcbf892a
[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 MultiViews FollowSymLinks
28         AddType text/html   .php
29         AddType application/xml   .phpx
30         AddType application/json   .phpj
31     </Directory>
32
33     <Location />
34 <% if node[:lsb][:release].to_f >= 14.04 -%>
35         ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
36         ProxyPassMatch ^/(.*\.phpx(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
37         ProxyPassMatch ^/(.*\.phpj(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
38 <% else -%>
39         AddHandler fcgi:/var/run/php5-fpm-www.sock .php
40         AddHandler fcgi:/var/run/php5-fpm-www.sock .phpx
41         AddHandler fcgi:/var/run/php5-fpm-www.sock .phpj
42 <% end -%>
43     </Location>
44
45     <% @pools.each do |name,details| -%>
46     Alias /pool-<%= name %>/ "<%= @directory %>/website/"
47     <Location /pool-<%= name %>>
48 <% if node[:lsb][:release].to_f >= 14.04 -%>
49         ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:<%= details[:port ]%>/
50         ProxyPassMatch ^/(.*\.phpx(/.*)?)$ fcgi://127.0.0.1:<%= details[:port ]%>/
51         ProxyPassMatch ^/(.*\.phpj(/.*)?)$ fcgi://127.0.0.1:<%= details[:port ]%>/
52 <% else -%>
53         AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .php
54         AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .phpx
55         AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .phpj
56 <% end -%>
57     </Location>
58     <% end -%>
59
60     Redirect 420 /pool-block/
61     ErrorDocument 420 /509.html
62     <Location /pool-block>
63         ErrorDocument 420 /509.html
64     </Location>
65     Redirect 403 /pool-ban/
66     <Location /pool-ban>
67         ErrorDocument 403 /403.html
68     </Location>
69     ErrorDocument 403 /403.html
70
71     RewriteEngine On
72
73     # manual blocks
74     Include <%= @directory %>/settings/apache_blocks.conf
75
76     # regular requests and autoblocks
77     RewriteMap bulklist txt:<%= @directory %>/settings/ip_blocks.map
78     RewriteRule ^/([sdr].*) /pool-${bulklist:%{REMOTE_ADDR}|www}/$1 [PT]
79
80 </VirtualHost>
81
82 <% end -%>