Skip to content

Installing

The outcome of this chapter is a running NPM, installed the way the project intends: one Docker container, three ports, and one folder on your machine that holds everything worth backing up. NPM's makers ship it as a container because of chapter 2's moving parts — the backend, the interface, nginx and Certbot must agree about paths and versions, and the container is where that agreement is kept. Installing the parts natively, as this guide's lab did to study them, is not the reader's path; the lab's transcripts exist so you can see the insides, not as an install recipe.

What you need: a machine that runs Docker (with the Compose plugin), reachable DNS names for the services you will publish — the names must resolve to this machine's public address for certificates to work later — and three free ports: 80 and 443 for the proxied traffic itself, and 81 for the admin interface.

The install, in full. Create a folder for NPM, and inside it a file named docker-compose.yml with the project's own contents:

services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

Then, in that folder:

docker compose up -d

That is the whole ceremony. Compose downloads the image, starts the container, and restarts it after reboots (unless-stopped). Two volumes carry your state out of the container: ./data becomes /data — the database, the signing keys and every generated nginx file — and ./letsencrypt becomes /etc/letsencrypt, where Certbot keeps the certificates it wins. Backups, upgrades and migrations all reduce to stop the container, copy those two folders — remember this when chapter 13 talks about limits, because it is also the upgrade story: a new image plus the same two folders.

The check: after a minute, open http://<your-machine>:81 in a browser. The NPM login page (or, on a fresh install, the setup screen of chapter 4) means every moving part started. No page at all means the container or the port mapping is unhappy — docker compose ps and docker compose logs in the install folder are the two commands that will say which. A page on 81 but errors later point inward, at the backend, per chapter 2's map.

Choices you can postpone, named so they do not ambush you later. The database defaults to SQLite inside /data; the project documents environment variables (DB_MYSQL_*, DB_POSTGRES_*, DB_SQLITE_FILE) for pointing NPM at an external database — worth it for a busy multi-user install, unnecessary weight for a household. The lab's own configuration file, nginx-proxy-manager-lab/backend-config.json, shows the SQLite arrangement from the inside. And INITIAL_ADMIN_EMAIL / INITIAL_ADMIN_PASSWORD environment variables can pre-create the first administrator at first start — chapter 4 explains both ways to get one, and why the interactive way is the default this guide teaches.