What is/are the best way(s) to host mbtiles?

I have tried:

  • hosting on my own server with tileserver.php: this works and is very straighforward and simple to set up, but doesn't seem to be super fast (maybe a problem with my server) and I fear that when the site opens to the world it will simply break down; (also, tileserver.php sends HTTP error 500 when a tile isn't found, which I find misleading?)
  • hosting on S3 (1 tile per S3 object): serving tiles is very efficient and fast, but uploading to S3 using tilecloud always raises an S3 error "connection reset by peer" in the middle of the process, so uploading never ends properly and more than half the tiles are not sent (and it seems that trying again just restarts everything from the beginning)

MapBox would be the obvious choice but their prices seem very high?

The mbtiles file is under 500 Mo for zoom levels [9,15], gets to 1 Go for levels [9,16] and 2.7 Go for levels [9,17]; I can live with [9,15].

S3 would be the simplest for me, if I can find a way to upload all tiles without error (or, with an error that can be debugged: S3 logging doesn't show anything for the error I'm experiencing).

Any other idea?

3 Answers 3


The best solution for hosting MBTiles depends on the scale. The solution for 10000 tile requests per month can be very different than the best solution for handling tens or hundreds of requests per second, but S3 works pretty well for both.

S3 can be much cheaper than MapBox if your hosting your own data and not using any of their rendering. At large enough scale S3 can start to be expensive, and it can be much cheaper to serve tiles from a VPS.

I upload a lot of tiles to s3, and my current solution is to launch a small or micro ec2 instance in the aws region the bucket is in(usually US-east), copy the MBTiles file to it with scp, then extract the tiles with MBUtil, and upload them with s3cmd. If you do this it can be handy to create an AMI all setup for this purpose, then just launch it when you need it.

Update 9/2017 I've written a utility for uploading tiles from an MBTiles file to s3 in parallel, using 100 threads im able to upload about 500 tiles per second. Script is available on github

  • 1
    Great idea to upload the mbtiles file to EC2 and do the export from within the instance! Thanks!
    – Bambax
    Commented Mar 17, 2014 at 12:34
  • 4
    if you are in 9/2017, can you tell me if the US president is a woman ? Commented Oct 1, 2016 at 21:59
  • I'm also looking for a solution for hosting mbtiles. I'm no so familiar with S3 but what is the advantage of using a EC2 for converting the .mbtiles instead of converting them locally and uploading the generated folders instead? What would be the pros / cons of using a mbtile server e.g. npmjs.com/package/mbtiles-server ?
    – Jan
    Commented Jan 21, 2018 at 16:17
  • And about reading the tiles directly from S3, are you using something for that? I'm using the npm package (@mapbox/mbtiles) but I can only read local filesystem tiles. Commented Mar 27, 2023 at 15:36

7 years later, there are now other formats similar to MBtiles (i.e. single-file, supporting raster & tile, GIS, leaflet...) that are "cloud-optimized":

Cloud-optimized here means that the tiles are organized in the file so that they can be served from the single-file using HTTP range headers. This allows to replace the serving layer, which lowers hosting cost significantly.

HTTP range headers are not supported everywhere, Cloud Storage Platforms for PMTiles lists some known working providers.


Hosting on Amazon S3 is extremely easy with MapTiler (http://www.maptiler.com), which includes an easy to use high-performance (=parallel) uploader for Amazon S3 and Google Cloud Storage. See this video: https://www.youtube.com/watch?v=A5gFXvxWIHM&list=PLGHe6Moaz52PiQd1mO-S9QrCjqSn1v-ay&index=9

In case you want to host MBTiles (including interactivity, etc) on your own PHP hosting - you could also try the open-source project https://github.com/klokantech/tileserver-php/. A video tutorial is here: https://www.youtube.com/watch?v=F6MvDvc5m-I&list=PLGHe6Moaz52PiQd1mO-S9QrCjqSn1v-ay&index=2

Both of these hosting approaches will provide you also with OGC WMTS compatibility, and sample viewers - so the maps can be easily reused in various GIS tools to JavaScript mapping libraries such as Google Maps API, Leaflet or OpenLayers.

  • 4
    Maybe an explicit disclosure statement would be applicable here.
    – BradHards
    Commented Jul 20, 2015 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.