Skip to content

Latest commit

 

History

History
96 lines (65 loc) · 2.2 KB

README.md

File metadata and controls

96 lines (65 loc) · 2.2 KB

Setup Guide

Docker

git clone https://github.com/mnvoh/OpenStreetMap-Docker.git
  • Change directory to the docker project
cd OpenStreetMap-Docker
  • Make a copy of .env.sample to .env and optionally customize the values
cp .env.sample .env
  • Build the images
docker-compose build
  • Obtain the OSM data, either the planet or a region of your choice and put it in the data directory as import.osm.pbf
wget -O web/data/import.osm.pbf http://download.geofabrik.de/asia/iran-latest.osm.pbf
  • Run it!
docker-compose up

After you made sure that everything's working, you can daemonize it: docker-compose up -d

Also if you wanna have a much faster startup, remove import.osm.pbf so that it's not imported again on the next run.

Access maps on a domain

Out of the box, there's very simple html file with Leaflet setup. All you need to do is open it and change the used domains. For example change:

var osmUrl='http://maps{s}.nozary.com/hot/{z}/{x}/{y}.png';

To:

var osmUrl='http://{s}.maps.your-domain.tld/hot/{z}/{x}/{y}.png';

How the subdomains should be set depends on how you've set your DNS records and web server configurations. In this case I've set it to use mapsa.nozary.com, mapsb.nozary.com, so on and so forth. Although a.maps.your-domain.com seems to be more appealing.

Web Server Configuration

Whether you're using Apache or Nginx, all you have to do is setup a simple reverse proxy. Here are example configurations for both web servers.

Apache

<VirtualHost *:80>
  ServerName maps.nozary.com
  ServerAlias a.maps.nozary.com b.maps.nozary.com c.maps.nozary.com
  <Proxy *>
    Allow from localhost
  </Proxy>
  ProxyPass / http://localhost:8080/
</VirtualHost>

Nginx

server {
	listen 80;
	server_name: maps.nozary.com a.maps.nozary.com b.maps.nozary.com c.maps.nozary.com
	location / {
		proxy_pass http://localhost:8080
	}
}

Roadmap

Pull Requests are welcome.