DEV Community

Cover image for Deploy your own open-source Web GIS server instance on a VPS in 15 minutes with Docker
Eduard Kazakov
Eduard Kazakov

Posted on

Deploy your own open-source Web GIS server instance on a VPS in 15 minutes with Docker

If your team works with geospatial data, sooner or later you need a place where maps, layers, users, and edits live together. There are many capable SaaS platforms and proprietary solutions you can deploy on your own infrastructure, but there is another path: self-hosting an open-source Web GIS server.

In this tutorial, we will deploy NextGIS Web on a low-cost VPS using Docker, and then configure a reverse proxy with HTTPS.

By the end, you will have your own Web GIS server up and running on the internet. We will also show how to establish connection between deployed NextGIS Web instance and QGIS.

What we are building

We'll deploy:

  • NextGIS Web
  • Docker + Docker Compose
  • Nginx Proxy Manager
  • Free Let's Encrypt SSL certificate
  • Public URL like gis.yourdomain.com

This setup is typical, and relevant for GIS consultants, municipalities, research labs, internal mapping teams, and startups building location-based products.

Why NextGIS Web

There are many mature components you can use to build a GIS stack: PostGIS, GeoServer, MapServer, MapStore, and others. However, they typically function as separate building blocks: one handles data storage, another data publishing, and another map rendering.

NextGIS Web takes a different approach. It is a complete, integrated solution covering everything from data storage and user management to data publishing and a built-in web map engine. It is a mature open-source product with over 12 years of development. One of its key strengths is deep integration with QGIS, the leading open-source desktop GIS application.

The official Docker build (NextGIS Web Community Edition) makes deployment straightforward and fast.

Prerequisites

A basic VPS with x86-64 architecture is sufficient to follow this tutorial. For reference, I am using an MVPS VPS with the following configuration:

  • 2 CPU cores
  • 4 GB RAM
  • 50 GB SSD
  • Ubuntu 24.04

You can also use a dedicated server or even a local machine.

This tutorial assumes you have root SSH access to the host.

Is is also assumed that you have a domain and access to its management panel, although this is optional.

Step 1. Prepare your server

First, SSH into the server:

ssh root@your-server-ip

Then update the packages:

apt update && apt upgrade -y

Install Docker:

curl -fsSL https://get.docker.com | sh

Install the Docker Compose plugin:

apt install docker-compose-plugin -y

Make sure you have Docker Compose version 2.x:

docker --version
docker compose version

Step 2. Deploy NextGIS Web

First, create a folder for NextGIS Web and navigate to it:

mkdir /srv/ngw_ce
cd /srv/ngw_ce

Create a /srv/ngw_ce/.env file with the current image version according to the repository:

nano .env

Enter:

IMAGE_VERSION=26.04.0

Now create the Docker Compose file /srv/ngw_ce/docker-compose.yaml:

nano docker-compose.yaml

Fill it with:

services:
  app:
    image: nextgis/nextgisweb-ce:$IMAGE_VERSION
    command: server
    environment:
      NEXTGISWEB__CORE__LOCALE__DEFAULT: "en"
    ports:
      - 8080:8080
    volumes:
      - data:/opt/crater/data
      - backup:/opt/crater/backup
    restart: unless-stopped
volumes:
  data:
  backup:
Enter fullscreen mode Exit fullscreen mode

Pay attention to the environment section. General configuration of NextGIS Web is managed through environment variables.

Run the stack:

docker compose up -d

Now open http://YOUR_SERVER_IP:8080. You should see the NextGIS Web authorization screen.

NextGIS Web authorization screen

By default, use administrator / admin credentials. After logging in, you will see the administrative interface with the resource tree (initially containing only the default resource).

NextGIS Web resource tree

Click Create resource to access available resource types: folders, layers, maps, services, database connections, etc.

NextGIS available resources

! Important: Change the default password.

Go to Control Panel → Users

NextGIS Web control panel - users

Edit the Administrator account, and assign a new password.

NextGIS Web change password

Let's return to the console. If you want to explore the list of available environment variables, while in /srv/ngw_ce/, run:

docker compose run --rm app nextgisweb-config --env-vars

After setting up the required configuration in the environment section of /srv/ngw_ce/docker-compose.yaml, update the stack using:

docker compose up -d

Step 3. Configure Nginx Reverse Proxy and DNS record

A Web GIS server handles users and data, so using it without encryption could be risky from a security perspective. It is highly recommended to run it behind a reverse proxy that handles TLS termination.

First, install Nginx:

apt install nginx -y

Create a new config:

nano /etc/nginx/sites-available/nextgis_web

Fill in content (replace gis.yourdomain.com with your domain):

map $http_upgrade $proxy_connection {
    default upgrade;
    ''      close;
}

server {
    server_name gis.yourdomain.com;

    location / {
        client_max_body_size 0;
        proxy_read_timeout 3600s;

        proxy_http_version 1.1;
        proxy_pass http://localhost:8080;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $proxy_connection;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}
Enter fullscreen mode Exit fullscreen mode

And enable the site

ln -s /etc/nginx/sites-available/nextgis_web /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx

In your domain management panel, create a DNS record:

  • Type: A
  • Host: gis (for gis.yourdomain.com)

Example of how it looks in the Porkbun interface:

DNS settings

Wait 5-15 minutes (more in rare cases) for DNS propagation. Test it using dig.

If you see the IP address displayed correctly, DNS propagation is complete.

Step 4. Add HTTPS

The simplest and most straightforward way to obtain a certificate is to use Certbot with python3-certbot-nginx. First, install them:

apt install certbot python3-certbot-nginx -y

Request a certificate:

certbot --nginx -d gis.yourdomain.com

Certbot will automatically update the Nginx configuration.

Then open https://gis.yourdomain.com

Congratulations! You have just properly set up HTTPS access to your own NextGIS Web instance, and can now use it safely.

Maintenance and backup

To use NextGIS Web sustainably, it is important to set up regular maintenance and backups.

Run maintenance:

cd /srv/ngw_ce
docker compose exec app nextgisweb maintenance

This removes unreferenced files and performs cleanup tasks.

Create a backup:

cd /srv/ngw_ce
docker compose exec app nextgisweb backup

Backups are stored in /opt/crater/backup/ with timestamps.

Set up regular cron jobs for automated maintenance and backups.

Connect from QGIS and publish a project

NextGIS Web can be fully managed via the web interface, but it is designed to integrate tightly with QGIS.

Install the latest stable version of QGIS from qgis.org, then run the QGIS Desktop application.

If you don't work with QGIS, download this sample: Mostar_QGIS.zip

Unpack the archive, and open the file Mostar.qgz in QGIS. This project is compact but includes different types of data with advanced styling. Enable or disable different layers in the Layers panel to explore it.

QGIS Project

Install the NextGIS Connect plugin in QGIS (Plugins - Manage and Install Plugins - All - NextGIS Connect):

NextGIS Connect installation

In the NextGIS Connect panel, open Settings

NextGIS Connect settings button

Then create a new connection. Use your Web GIS address and set up basic authentication with the administrator as the login and the password you defined in Step 2.

NextGIS Connect establish connection

Now you can see the resource tree of your Web GIS inside QGIS. Select the Main resource group, then use Add to Web GIS → Upload All.

NextGIS Connect upload data to NextGIS Web

All the data and styles are uploaded to NextGIS Web, and a web map is created and opened automatically.

NextGIS Web Web Map

The web map in display mode has its own link, so you can share and embed it.

You can continue working with the uploaded data independently via the web interface, as well as adjust web map settings, resource permissions, and everything else. Explore the uploaded resources and what you can do with them.

NextGIS Web resource tree with uploaded layers

Edit data from QGIS and review version history

You can also connect to the published data from QGIS. Reopen QGIS and, in the NextGIS Connect panel, find a published map. Right-click on it and select Add to QGIS.

NextGIS Connect add remote data

The project will be rebuilt, and all layers will be linked to the web storage. If you edit any of the layers, for example, by adding a new feature, the change will be automatically synchronized with the server, and the new object will become visible on the web map.

You can also review the history of a vector layer to see who made changes, when, and what was modified. To view the change you made, find the layer in the Web GIS interface and select Version History from its context menu.

NextGIS Web open version history

It is also possible to roll back changes to a desired state or create a layer branch using the context menu of a particular version.

NextGIS Web rollback changes

API and SDK

NextGIS Web provides an API that covers all core functions, including user, data, service, and map management. You can explore the available methods for your deployed instance at gis.yourdomain.com/doc/api (or use the public sandbox as an example: sandbox.nextgis.com/doc/api).

There is also a public JavaScript SDK to help you quickly build custom web applications on top of the NextGIS Web API: https://github.com/nextgis/nextgis_frontend

Summary

The demonstrated steps allow you to quickly deploy your own instance of NextGIS Web and set it up for sustainable long-term use, as well as establish a connection with QGIS for data export and collaborative editing.

Use the application GitHub page to learn more about how to use it or to report a bug.

Top comments (0)