]> git.openstreetmap.org Git - chef.git/blob - cookbooks/nominatim/templates/default/apache.erb
Use mod_proxy_fcgi on 14.04
[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 nominatim.openstreetmap.org
6     ServerAdmin webmaster@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
13 <% if port == 443 -%>
14     #
15     # Enable SSL
16     #
17     SSLEngine on
18 <% end -%>
19
20     CustomLog /var/log/apache2/nominatim.openstreetmap.org-access.log combined
21     ErrorLog /var/log/apache2/nominatim.openstreetmap.org-error.log
22
23     DocumentRoot <%= @directory %>/website
24     <Directory "<%= @directory %>/website/">
25         DirectoryIndex search.php
26         Options MultiViews FollowSymLinks
27         AddType text/html   .php
28         AddType application/xml   .phpx
29         AddType application/json   .phpj
30 <% if node[:lsb][:release].to_f >= 14.04 -%>
31         ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php5-fpm-www.sock|fcgi://localhost<%= @directory %>/website/
32         ProxyPassMatch ^/(.*\.phpx(/.*)?)$ unix:/var/run/php5-fpm-www.sock|fcgi://localhost<%= @directory %>/website/
33         ProxyPassMatch ^/(.*\.phpj(/.*)?)$ unix:/var/run/php5-fpm-www.sock|fcgi://localhost<%= @directory %>/website/
34 <% else -%>
35         AddHandler fcgi:/var/run/php5-fpm-www.sock .php
36         AddHandler fcgi:/var/run/php5-fpm-www.sock .phpx
37         AddHandler fcgi:/var/run/php5-fpm-www.sock .phpj
38 <% end -%>
39     </Directory>
40
41     <% @pools.each do |name,details| -%>
42     Alias /pool-<%= name %>/ "<%= @directory %>/website/"
43     <Location /pool-<%= name %>>
44 <% if node[:lsb][:release].to_f >= 14.04 -%>
45         ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php5-fpm-<%= name %>.sock|fcgi://localhost<%= @directory %>/website/
46         ProxyPassMatch ^/(.*\.phpx(/.*)?)$ unix:/var/run/php5-fpm-<%= name %>.sock|fcgi://localhost<%= @directory %>/website/
47         ProxyPassMatch ^/(.*\.phpj(/.*)?)$ unix:/var/run/php5-fpm-<%= name %>.sock|fcgi://localhost<%= @directory %>/website/
48 <% else -%>
49         AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .php
50         AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .phpx
51         AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .phpj
52 <% end -%>
53     </Location>
54     <% end -%>
55
56     Redirect 420 /pool-block/
57     ErrorDocument 420 /509.html
58     <Location /pool-block>
59         ErrorDocument 420 /509.html
60     </Location>
61     Redirect 403 /pool-ban/
62     <Location /pool-ban>
63         ErrorDocument 403 /403.html
64     </Location>
65     ErrorDocument 403 /403.html
66
67     RewriteEngine On
68
69     # manual blocks
70     Include <%= @directory %>/settings/apache_blocks.conf
71
72     # regular requests and autoblocks
73     RewriteMap bulklist txt:<%= @directory %>/settings/ip_blocks.map
74     RewriteRule ^/([sdr].*) /pool-${bulklist:%{REMOTE_ADDR}|www}/$1 [PT]
75
76 </VirtualHost>
77
78 <% end -%>