From 222c77444fd3239a816e1d996cf8d575a7d82786 Mon Sep 17 00:00:00 2001 From: Angelika Ophagen Date: Mon, 20 Feb 2023 21:26:25 +0100 Subject: [PATCH] \#22: add missing file --- nginx-site.default | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 nginx-site.default diff --git a/nginx-site.default b/nginx-site.default new file mode 100644 index 0000000..3ff630b --- /dev/null +++ b/nginx-site.default @@ -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; + } + } +}