Knowledge.sk

zdieľaj svoje vedomosti

Nástroje používateľa

Nástoje správy stránok


blog:proxy-pass-tile-server-with-nginx

Host your own tile cache with Nginx (No more slow cyclosm)

So it all started with ridiculous slowness of the cyclosm.org and underlying 3 tile servers. Average time of load spans between 3 to 15 seconds. There is nothing in the world, that is more annoyting than waiting for tile to load and render. So I said, to hell with it.

First I was searching for some offline map downloader for linux, but struggled to find one. I know for sure there is something out there, but nothing was simple to install and run.

So I setupped nginx, that will serve as a cache and proxy pass. Then I downloaded “Redirector” extension, that will redirect each request that would go to the cyclosm tileserver, to the localhost with the same path. Then nginx will serve image straight from the cache, or will load from the path and from the original tile server.

http {
  proxy_cache_path /var/cache/nginx/tiles levels=1:2 keys_zone=tiles_cache:10m max_size=5g inactive=30d use_temp_path=off;
  
  ...
}

Install Redirector extension available in Chrome or Firefox. Add new setting:

 Redirect:
https://*.tile-cyclosm.openstreetmap.fr/*

to:
http://localhost:8999/$2

Example:
https://aaa.tile-cyclosm.openstreetmap.fr/cycloms/1/2/2.png → http://localhost:8999/cycloms/1/2/2.png

Applies to:
Images

where localhost:8999 is the address where my nginx server is running, set it to your own location of the server.

blog/proxy-pass-tile-server-with-nginx.txt · Posledná úprava: od 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki