Welcome! Log In Create A New Profile

Advanced

Re: Caching OSM tiles

Cedric Jeanneret
May 11, 2010 06:24AM
On Tue, 11 May 2010 11:34:32 +0400
Igor Sysoev <igor@sysoev.ru> wrote:

> On Tue, May 11, 2010 at 08:37:19AM +0200, Cedric Jeanneret wrote:
>
> > Hello!
> >
> > I'm currently developping a really tiny app using OpenLayers[1] and OpenStreetMap[2].
> > As I was testing it, I saw that sometimes tiles don't come. I guess this is caused by server load at OSM. So I was thinking about caching some tiles so that it won't overload OSM, and my app will work nicely.
> >
> > Has anybody ever tried it ? if so, how can we do it ?
> > If no one has tested/tried it, any hints/ideas ?
> >
> > I guess I should configure a special vhost like "tiles.domain.ltd", proxy-ing tiles.openstreetmap.org, with some caching, and tell OpenLayers to use OSM tiles through this proxy. Right ?
>
> Yes.
>
>
Just for the posterity:

proxy_cache_path /home/tilecache levels=1:2:2 keys_zone=tilecache:1536m;

server {
listen 94.23.198.39:80;
server_name tiles.domain.ltd;

access_log /var/log/nginx/tiles_access.log main;
error_log /var/log/nginx/tiles_error.log info;
location / {
proxy_pass http://tile.openstreetmap.org/ ;
proxy_cache tilecache;
proxy_cache_key "$scheme$host$request_uri";
proxy_cache_valid 200 302 300h;
proxy_cache_valid 404 1m;
}
}

And I modified openlayers.js in this way :
- true,url:'http://tile.openstreetmap.org/${z}/${x}/${y}
+ true,url:'http://tiles.internux.ch/${z}/${x}/${y}

It just works fine.

Beware of cache size - mine is a small one as I'm not coverring a big area.

Thanks again.

C.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Caching OSM tiles

Cedric Jeanneret May 11, 2010 02:42AM

Re: Caching OSM tiles

Igor Sysoev May 11, 2010 03:38AM

Re: Caching OSM tiles

Cedric Jeanneret May 11, 2010 06:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready