Last active
October 3, 2019 06:34
-
-
Save cquest/ef82d82e7700e116b340ca3f77532880 to your computer and use it in GitHub Desktop.
Exemple de configuration nginx pour installer un cache de tuiles OSM
This file contains hidden or 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
# conserver les tuiles dans /var/cache, pendant 24h et au maximum 16Go | |
proxy_cache_path /var/cache/nginx-tilecache levels=1:2 keys_zone=tilecache:100m inactive=24h max_size=16G; | |
server { | |
server_name tilecache.mondomaine.tld a.tilecache.mondomaine.tld b.tilecache.mondomaine.tld c.tilecache.mondomaine.tld; | |
listen 80; | |
location / { | |
proxy_pass http://tilecache.openstreetmap.fr; | |
proxy_cache tilecache; | |
proxy_cache_valid 200 302 24h; | |
proxy_cache_valid 404 1m; | |
proxy_cache_lock on; | |
# on ajoute l'IP du client dans la requête vers le upstream | |
proxy_set_header X-Forwarded-For $remote_addr; | |
# on indique le status du cache dans la réponse au client | |
add_header X-Cache-Status $upstream_cache_status; | |
# si upstream down, on envoie la copie qu'on a en cache | |
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Merci ;-)