-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Angelika Ophagen
committed
Feb 20, 2023
1 parent
3582618
commit 222c774
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
server_tokens off; | ||
|
||
proxy_cache_path /var/www/cache levels=1:2 keys_zone=osm-backend-cache:8m max_size=5g inactive=7d; | ||
|
||
upstream osm_backend { | ||
server a.tile.openstreetmap.org; | ||
server b.tile.openstreetmap.org; | ||
server c.tile.openstreetmap.org; | ||
} | ||
|
||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
root /var/www/html; | ||
index index.html; | ||
server_name _; | ||
|
||
location / { | ||
# First attempt to serve request as file, then | ||
# as directory, then fall back to displaying a 404. | ||
try_files $uri $uri/ =404; | ||
} | ||
|
||
location ~ ^/tiles-cache/(.*)$ { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X_FORWARDED_PROTO http; | ||
proxy_set_header Host $http_host; | ||
|
||
proxy_cache osm-backend-cache; | ||
proxy_hide_header Set-Cookie; | ||
proxy_ignore_headers Set-Cookie; | ||
proxy_cache_valid 200 302 7d; | ||
proxy_cache_valid 404 1m; | ||
proxy_redirect off; | ||
if (!-f $request_filename) { | ||
proxy_pass http://osm_backend/$1; | ||
break; | ||
} | ||
} | ||
} |