1 # DO NOT EDIT - This file is being maintained by Chef
3 <% [80, 443].each do |port| -%>
4 <VirtualHost *:<%= port %>>
5 # Basic server configuration
6 ServerName <%= node[:fqdn] %>
7 ServerAlias tile.openstreetmap.org
8 ServerAlias render.openstreetmap.org
9 ServerAdmin webmaster@openstreetmap.org
17 SSLCertificateFile /etc/ssl/certs/<%= node[:fqdn] %>.pem
18 SSLCertificateKeyFile /etc/ssl/private/<%= node[:fqdn] %>.key
21 # Configure location of static files and CGI scripts
22 DocumentRoot /srv/tile.openstreetmap.org/html
23 ScriptAlias /cgi-bin/ /srv/tile.openstreetmap.org/cgi-bin/
25 # Get the real remote IP for requests via a trusted proxy
26 RemoteIPHeader X-Forwarded-For
27 <% @caches.each do |cache| -%>
28 <% cache.ipaddresses(:role => :external).sort.each do |address| -%>
29 RemoteIPTrustedProxy <%= address %>
34 LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
35 CustomLog /var/log/apache2/access.log combined_with_remoteip
36 ErrorLog /var/log/apache2/error.log
39 # Always set Access-Control-Allow-Origin so that simple CORS requests
40 # will always work and can be cached
41 Header set Access-Control-Allow-Origin "*"
43 # Remove Proxy request header to mitigate https://httpoxy.org/
44 RequestHeader unset Proxy early
46 # Enable the rewrite engine
49 # Rewrite tile requests to the default style
50 RewriteRule ^/(-?\d+)/(-?\d+)/(-?\d+)\.png$ /default/$1/$2/$3.png [PT,T=image/png,L]
51 RewriteRule ^/(-?\d+)/(-?\d+)/(-?\d+)\.png/status/?$ /default/$1/$2/$3.png/status [PT,T=text/plain,L]
52 RewriteRule ^/(-?\d+)/(-?\d+)/(-?\d+)\.png/dirty/?$ /default/$1/$2/$3.png/dirty [PT,T=text/plain,L]
54 # Historical Files redirect
55 RedirectPermanent /processed_p.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/processed_p.tar.bz2
56 RedirectPermanent /shoreline_300.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/shoreline_300.tar.bz2
57 RedirectPermanent /world_boundaries-spherical.tgz https://planet.openstreetmap.org/historical-shapefiles/world_boundaries-spherical.tgz
59 # Redirect ACME certificate challenges
60 RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
64 <Directory /srv/tile.openstreetmap.org/html>
70 <Directory /srv/tile.openstreetmap.org/cgi-bin>