Fork me on GitHub

TileMill on your Web server behind a reverse proxy

In the last version (0.9), TileMill has an additional dedicated process to serve the tiles. We had to change some bits of our server configuration.

Instead of documenting the new configuration in our internal Wiki, I prefered to share here a few technical lines (quite rough though).

We run TileMill inside a virtual machine on a server with reverse proxy rules.

Reverse Proxy configuration

Assuming your reach your TileMill virtual machine at tilemill.sillywalk.loc, with its two processes running (ports 20008 for tiles, 20009 for the application), your Apache reverse proxy configuration will be :

<VirtualHost *:80>

    ProxyPreserveHost On
    RewriteEngine on

    # Serve the tiles as /tiles/
    RewriteCond %{REQUEST_URI} ^(/tiles.*)$
    RewriteRule ^/tiles(.*) http://tilemill.sillywalk.loc:20008$1 [L,P]
    ProxyPassReverse /tiles http://tilemill.sillywalk.loc:20008/

    # Serve the application on /
    ProxyPass / http://tilemill.sillywalk.loc:20009/
    ProxyPassReverse / http://tilemill.sillywalk.loc:20009

TileMill configuration

Now that tiles and application ports are reachable respectively on and, just tell TileMill to serve its pages accordingly in its configuration, /etc/tilemill/tilemill.config :

  "files": "/usr/share/mapbox",
  "server": true,
  "coreUrl": "",
  "tileUrl": "",
  "port": 20009,
  "listenHost": ""

Restart it...

sudo service tilemill restart

Done !

Comments !