]> git.openstreetmap.org Git - chef.git/blob - cookbooks/overpass/templates/default/apache.erb
8ccd28a9d3eae34cfe2e2eabcca8614a03073144
[chef.git] / cookbooks / overpass / templates / default / apache.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:80>
4         ServerName <%= node[:fqdn] %>
5         ServerAlias <%= node[:overpass][:fqdn] %>
6         ServerAdmin webmaster@openstreetmap.org
7
8         CustomLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-access.log combined
9         ErrorLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-error.log
10
11         DocumentRoot <%= @directory %>
12
13         RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
14         RedirectPermanent / https://<%= @name %>/
15 </VirtualHost>
16
17
18 <VirtualHost *:443>
19         ServerName <%= node[:fqdn] %>
20         ServerAlias <%= node[:overpass][:fqdn] %>
21         ServerAdmin webmaster@openstreetmap.org
22
23         CustomLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-access.log combined
24         ErrorLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-error.log
25
26         SSLEngine on
27         SSLCertificateFile /etc/ssl/certs/<%= node[:fqdn] %>.pem
28         SSLCertificateKeyFile /etc/ssl/private/<%= node[:fqdn] %>.key
29
30         DocumentRoot <%= @directory %>
31
32         RewriteEngine on
33         RewriteMap totp prg:/srv/query.openstreetmap.org/apache/totp-filter
34         RewriteCond ${totp:%{HTTP_COOKIE}} =0
35         RewriteRule ^/query-features - [F,L]
36
37 <% if node[:overpass][:restricted_api] -%>
38         ScriptAlias /query-features <%= @script_directory %>/interpreter
39         SetEnvIf Origin "http.*(osm.org|openstreetmap.org).*" AccessControlAllowOrigin=$0
40         # Remove Origin so Overpass does not interfere.
41         RequestHeader unset Origin
42         Header always add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
43         Header always add Access-Control-Allow-Credentials true
44 <% else -%>
45         ScriptAlias /api/ <%= @script_directory %>/
46 <% end -%>
47 </VirtualHost>
48
49 <Directory "<%= @directory %>">
50         Require all granted
51 </Directory>
52
53 <Directory "<%= @script_directory %>">
54         SetOutputFilter DEFLATE
55
56         AllowOverride None
57         Options +ExecCGI -MultiViews +FollowSymLinks
58         Require all granted
59 </Directory>