7

TileMill on your Web server behind a reverse proxy

 3 years ago
source link: https://blog.mathieu-leplatre.info/tilemill-on-your-web-server-behind-a-reverse-proxy.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
TileMill on your Web server behind a reverse proxy

TileMill on your Web server behind a reverse proxy

Tue 31 January 2012

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>
    ServerName tilemill.yourdomain.com

    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
</VirtualHost>

TileMill configuration

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

{
  "files": "/usr/share/mapbox",
  "server": true,
  "coreUrl": "tilemill.yourdomain.com:80",
  "tileUrl": "tilemill.yourdomain.com:80/tiles",
  "port": 20009,
  "listenHost": "0.0.0.0"
}

Restart it...

sudo service tilemill restart

Done !

#tilemill, #apache, #howto - Posted in the Sys category


© Copyright 2020 by Mathieu Leplatre. mnmlist Theme

Content licensed under the Creative Commons attribution-noncommercial-sharealike License.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK