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