Skip to content

Instantly share code, notes, and snippets.



Last active Oct 3, 2019
What would you like to do?
Exemple de configuration nginx pour installer un cache de tuiles OSM
# 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_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;

This comment has been minimized.

Copy link

@Cyrille37 Cyrille37 commented Oct 3, 2019

Merci ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment