]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tile/templates/default/apache.erb
Add support for systemd timer units
[chef.git] / cookbooks / tile / templates / default / apache.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:443>
4   # Basic server configuration
5   ServerName <%= node[:fqdn] %>
6   ServerAlias tile.openstreetmap.org
7   ServerAlias render.openstreetmap.org
8   ServerAdmin webmaster@openstreetmap.org
9
10   #
11   # Enable SSL
12   #
13   SSLEngine on
14   SSLProxyEngine on
15   SSLCertificateFile /etc/ssl/certs/<%= node[:fqdn] %>.pem
16   SSLCertificateKeyFile /etc/ssl/private/<%= node[:fqdn] %>.key
17
18   # Configure location of static files and CGI scripts
19   DocumentRoot /srv/tile.openstreetmap.org/html
20   ScriptAlias /cgi-bin/ /srv/tile.openstreetmap.org/cgi-bin/
21
22   # Get the real remote IP for requests via a trusted proxy
23   RemoteIPHeader X-Forwarded-For
24 <% @caches.each do |cache| -%>
25 <% cache.ipaddresses(:role => :external).sort.each do |address| -%>
26   RemoteIPTrustedProxy <%= address %>
27 <% end -%>
28 <% end -%>
29
30   # Setup logging
31   LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
32   CustomLog /var/log/apache2/access.log combined_with_remoteip
33   ErrorLog /var/log/apache2/error.log
34   BufferedLogs on
35
36   # Always set Access-Control-Allow-Origin so that simple CORS requests
37   # will always work and can be cached
38   Header set Access-Control-Allow-Origin "*"
39
40   # Remove Proxy request header to mitigate https://httpoxy.org/
41   RequestHeader unset Proxy early
42
43   # Enable the rewrite engine
44   RewriteEngine on
45
46   # Rewrite tile requests to the default style
47   RewriteRule ^/(-?\d+)/(-?\d+)/(-?\d+)\.png$ /default/$1/$2/$3.png [PT,T=image/png,L]
48   RewriteRule ^/(-?\d+)/(-?\d+)/(-?\d+)\.png/status/?$  /default/$1/$2/$3.png/status [PT,T=text/plain,L]
49   RewriteRule ^/(-?\d+)/(-?\d+)/(-?\d+)\.png/dirty/?$   /default/$1/$2/$3.png/dirty  [PT,T=text/plain,L]
50
51   # Historical Files redirect
52   RedirectPermanent /processed_p.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/processed_p.tar.bz2
53   RedirectPermanent /shoreline_300.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/shoreline_300.tar.bz2
54   RedirectPermanent /world_boundaries-spherical.tgz https://planet.openstreetmap.org/historical-shapefiles/world_boundaries-spherical.tgz
55
56   # Redirect ACME certificate challenges
57   RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
58 </VirtualHost>
59
60 <VirtualHost *:80>
61   # Basic server configuration
62   ServerName <%= node[:fqdn] %>
63   ServerAlias tile.openstreetmap.org
64   ServerAlias render.openstreetmap.org
65   ServerAdmin webmaster@openstreetmap.org
66
67   # Get the real remote IP for requests via a trusted proxy
68   RemoteIPHeader X-Forwarded-For
69 <% @caches.each do |cache| -%>
70 <% cache.ipaddresses(:role => :external).sort.each do |address| -%>
71   RemoteIPTrustedProxy <%= address %>
72 <% end -%>
73 <% end -%>
74
75   # Setup logging
76   LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
77   CustomLog /var/log/apache2/access.log combined_with_remoteip
78   ErrorLog /var/log/apache2/error.log
79   BufferedLogs on
80
81   # Always set Access-Control-Allow-Origin so that simple CORS requests
82   # will always work and can be cached
83   Header set Access-Control-Allow-Origin "*"
84
85   # Remove Proxy request header to mitigate https://httpoxy.org/
86   RequestHeader unset Proxy early
87
88   # Enable the rewrite engine
89   RewriteEngine on
90
91   # Redirect ACME certificate challenges
92   RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L]
93
94   # Redirect to https
95   RewriteCond %{REQUEST_URI} !^/server-status$
96   RewriteCond %{REQUEST_URI} !^/mod_tile$
97   RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=permanent,L]
98 </VirtualHost>
99
100 <Directory /srv/tile.openstreetmap.org/html>
101   Options None
102   AllowOverride None
103   Require all granted
104 </Directory>
105
106 <Directory /srv/tile.openstreetmap.org/cgi-bin>
107   Options ExecCGI
108   AllowOverride None
109   Require all granted
110 </Directory>