/
nginx.conf
64 lines (48 loc) · 1.89 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
proxy_cache_path /var/cache/nginx/tileserver
keys_zone=TileserverCache:50m
levels=1:2
inactive=2w
max_size=1g;
map_hash_bucket_size 128;
map $http_origin $allow_origin {
https://learscail.openstreetmap.ie $http_origin;
default "";
}
server {
listen 80;
listen [::]:80;
server_name learscail.openstreetmap.ie;
return 301 https://learscail.openstreetmap.ie/;
}
server {
server_name learscail.openstreetmap.ie;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/learscail.openstreetmap.ie/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/learscail.openstreetmap.ie/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# Disable root application access. You may want to allow this in development.
location ~ ^/$ {
rewrite ^/$ https://learscail.openstreetmap.ie/styles/ga/ permanent;
}
# Disable root application access. You may want to allow this in development.
location /favicon.ico {
return 404;
}
location / {
# This include directive sets up required headers for proxy and proxy cache.
# Aswell it includes the required ``X-Forwarded-*`` headers for tileserver to propely generate tiles.
include proxy_params;
proxy_pass http://127.0.0.1:8080;
# Disable default CORS headers
proxy_hide_header Access-Control-Allow-Origin;
# Enable proxy cache
proxy_cache TileserverCache;
proxy_cache_valid 200 1w;
# Set our custom CORS
add_header 'Access-Control-Allow-Origin' $allow_origin;
# If you need to see nginx cache status. Uncomment line below.
# add_header X-Cache-Status $upstream_cache_status;
}
}