1 # DO NOT EDIT - This file is being maintained by Chef
4 # Basic server configuration
5 ServerName <%= node.name %>
6 ServerAlias tile.openstreetmap.org
7 ServerAlias render.openstreetmap.org
8 ServerAdmin webmaster@openstreetmap.org
15 SSLCertificateFile /etc/ssl/certs/<%= node[:fqdn] %>.pem
16 SSLCertificateKeyFile /etc/ssl/private/<%= node[:fqdn] %>.key
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/
22 # Set location of renderd socket
23 ModTileRenderdSocketName /run/renderd/renderd.sock
25 # Set location of tile directory
26 ModTileTileDir /srv/tile.openstreetmap.org/tiles
28 # Time to wait for a re-render before serving a dirty tile
29 ModTileRequestTimeout 2
31 # Timeout before giving up for a tile to be rendered that is otherwise missing
32 ModTileMissingRequestTimeout 10
34 # Always try and re-render dirty or missing tiles
35 ModTileMaxLoadOld 1000
36 ModTileMaxLoadMissing 1000
38 # Maximum expiry to set on a tile
39 ModTileCacheDurationMax 604800
41 # Expiry time for dirty tiles that have been queued for re-rendering
42 ModTileCacheDurationDirty 900
44 # Minimum expiry time for fresh tiles
45 ModTileCacheDurationMinimum 10800
46 ModTileCacheDurationMediumZoom 13 86400
47 ModTileCacheDurationLowZoom 9 518400
49 # Factor controlling effect of last modification time on expiry
50 ModTileCacheLastModifiedFactor 0.20
52 # Load tile configuration
53 LoadTileConfigFile /etc/renderd.conf
55 # Get the real remote IP for requests via a trusted proxy
56 RemoteIPHeader Fastly-Client-IP
57 <% @fastly.sort.each do |address| -%>
58 RemoteIPTrustedProxy <%= address %>
62 LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
63 CustomLog /var/log/apache2/access.log combined_with_remoteip
64 ErrorLog /var/log/apache2/error.log
67 # Always set Access-Control-Allow-Origin so that simple CORS requests
68 # will always work and can be cached
69 Header set Access-Control-Allow-Origin "*" "expr=-z resp('Access-Control-Allow-Origin')"
71 # Add diagnostics header to identify render server
72 Header set X-TileRender "<%= node.name %>"
74 # Tell clients to use stale tiles if necessary
75 Header append Cache-Control "stale-while-revalidate=604800, stale-if-error=604800" "expr=%{CONTENT_TYPE} == 'image/png'"
77 # Remove Proxy request header to mitigate https://httpoxy.org/
78 RequestHeader unset Proxy early
80 # Enable the rewrite engine
83 # Rewrite tile requests to the default style
84 RewriteRule ^/(\d+)/(\d+)/(\d+)\.png$ /default/$1/$2/$3.png [PT,T=image/png,L]
85 RewriteRule ^/(\d+)/(\d+)/(\d+)\.png/status/?$ /default/$1/$2/$3.png/status [PT,T=text/plain,L]
86 RewriteRule ^/(\d+)/(\d+)/(\d+)\.png/dirty/?$ /default/$1/$2/$3.png/dirty [PT,T=text/plain,L]
88 # Historical Files redirect
89 RedirectPermanent /processed_p.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/
90 RedirectPermanent /shoreline_300.tar.bz2 https://planet.openstreetmap.org/historical-shapefiles/
91 RedirectPermanent /world_boundaries-spherical.tgz https://planet.openstreetmap.org/historical-shapefiles/
93 # Redirect ACME certificate challenges
94 RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
96 # Restrict tile access to CDN nodes and admins
97 <LocationMatch ^/default/\d+/\d+/\d+\.png$>
98 Require expr "%{CONN_REMOTE_ADDR} != %{REMOTE_ADDR}"
100 <% @fastly.sort.each do |address| -%>
101 Require ip <%= address %>
103 # StatusCake monitoring
104 <% @statuscake.sort.reject { |address| address.empty? }.each do |address| -%>
105 Require ip <%= address %>
108 <% @admins.sort.each do |address| -%>
109 Require ip <%= address %>
111 # OSM Amsterdam IPv4 (he.net)
112 Require ip 184.104.179.128/27
113 # OSM Amsterdam IPv4 (equinix)
114 Require ip 82.199.86.96/27
115 # OSM Amsterdam IPv6 (he.net)
116 Require ip 2001:470:1:fa1::/64
117 # OSM Amsterdam IPv6 (equinix)
118 Require ip 2001:4d78:500:5e3::/64
119 # OSM Dublin IPv4 (he.net)
120 Require ip 184.104.226.96/27
121 # OSM Dublin IPv4 (equinix)
122 Require ip 87.252.214.96/27
123 # OSM Dublin IPv6 (he.net)
124 Require ip 2001:470:1:b3b::/64
125 # OSM Dublin IPv6 (equinix)
126 Require ip 2001:4d78:fe03:1c::/64
128 Require ip 193.60.236.0/24
133 # Basic server configuration
134 ServerName <%= node.name %>
135 ServerAlias tile.openstreetmap.org
136 ServerAlias render.openstreetmap.org
137 ServerAdmin webmaster@openstreetmap.org
140 LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
141 CustomLog /var/log/apache2/access.log combined_with_remoteip
142 ErrorLog /var/log/apache2/error.log
145 # Always set Access-Control-Allow-Origin so that simple CORS requests
146 # will always work and can be cached
147 Header set Access-Control-Allow-Origin "*"
149 # Add diagnostics header to identify render server
150 Header set X-TileRender "<%= node.name %>"
152 # Remove Proxy request header to mitigate https://httpoxy.org/
153 RequestHeader unset Proxy early
155 # Enable the rewrite engine
158 # Redirect ACME certificate challenges
159 RewriteRule ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 [R=permanent,L]
162 RewriteCond %{REQUEST_URI} !^/server-status$
163 RewriteCond %{REQUEST_URI} !^/mod_tile$
164 RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=permanent,L]
167 <Directory /srv/tile.openstreetmap.org/html>
173 <Directory /srv/tile.openstreetmap.org/cgi-bin>