On this pageWhat lives in the container
Nginx Proxy Manager puts a web interface on top of nginx. You enter a host name and a target, click for a Let's Encrypt certificate, and it writes the nginx configuration and handles renewals. The project is MIT licensed, ships as a single Docker image and reached version 2.17.0 in November 2026. Its one sharp edge is the admin interface: it listens on its own port, 81, and a fresh install greets the first visitor with a screen that creates the administrator account. The setup below keeps that port off the internet from the first minute.
What lives in the container
The image bundles OpenResty (an nginx build), certbot, a Node.js backend and the web interface. Everything you create is stored in two folders mounted from the host, so the container itself is disposable:
| Host folder | Mounted at | Holds |
|---|---|---|
./data |
/data |
SQLite database with hosts, users and access lists; generated nginx files; logs; custom snippets |
./letsencrypt |
/etc/letsencrypt |
Certificates, private keys, the certbot account and renewal settings |
Prepare DNS and the firewall
Create an A record (and an AAAA record if you serve IPv6) for every host name you plan to proxy, pointing at the server. The default certificate method is the HTTP challenge, so port 80 must answer from the internet even if every site redirects to HTTPS.
Only three ports should be public: 22 for SSH, 80 and 443 for the proxy. Docker publishes ports by writing its own iptables rules, and its documentation states that traffic to published container ports is diverted before ufw's rules apply. A ufw deny 81 line does not protect a port that Compose published on all interfaces. Bind private ports to 127.0.0.1 instead, and filter at a firewall outside the operating system when you have one. On CloudSat, the Web server preset of a cloud firewall allows TCP 22, 80 and 443 plus ping and sits outside the server, where Docker's rules cannot reopen anything.
A Compose file with a private admin port
Create a shared network first; the proxy and every app join it, so apps need no published ports:
docker network create proxy
mkdir -p /opt/npm && cd /opt/npm
Save this as compose.yaml:
services:
npm:
image: jc21/nginx-proxy-manager:2.17.0
container_name: npm
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "127.0.0.1:81:81"
environment:
TZ: "UTC"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
healthcheck:
test: ["CMD", "/usr/bin/check-health"]
interval: 10s
timeout: 3s
networks:
default:
name: proxy
external: true
Compared with the project's example, port 81 is bound to the loopback address, the container joins the proxy network, and the opt-in health check lets docker compose ps report a broken proxy. Keep the tag pinned so upgrades happen when you decide. The first boot generates keys and builds the database, which can take a minute or two:
docker compose up -d
docker compose logs -f npm
First login through an SSH tunnel
From your own computer, forward a local port to the admin interface:
ssh -L 8181:127.0.0.1:81 root@203.0.113.10
Open http://localhost:8181 while the session stays open. Current releases have no default password: the page says "Get started by creating your admin account", and whoever reaches it first becomes the administrator.
You can skip the screen by setting INITIAL_ADMIN_EMAIL and INITIAL_ADMIN_PASSWORD, which create the account at startup. Treat that password as temporary: it sits in your Compose file in plain text and the startup code writes it to the container log, so change it after the first login.
Next, enable Two-Factor Authentication for your account (TOTP arrived in 2.13.6) and store the recovery codes with your other credentials.
Proxy your first app
A throwaway whoami container shows what an app receives. Note the missing ports: section: the app is reachable only on the proxy network.
services:
whoami:
image: traefik/whoami
container_name: whoami
restart: unless-stopped
networks:
default:
name: proxy
external: true
Start it with docker compose up -d in its own folder, then add a Proxy Host in the interface:
- Enter
whoami.example.comas the domain name. - Set Scheme to
http, Forward Hostname / IP towhoami(the container name) and Forward Port to80: the port the app listens on inside its container, not a published one. - Turn on Block Common Exploits. Turn on Websockets Support only for apps that need it, such as chat tools and browser IDEs.
- In the SSL settings, choose Request a new Certificate, then enable Force SSL and HTTP/2 Support. Leave HSTS Enabled for later: browsers remember HSTS, so switch it on once you are sure the host will stay on HTTPS.
Open https://whoami.example.com: the page echoes the request headers, and X-Real-IP and X-Forwarded-For should show your own address. An app that logs every visitor with the proxy's Docker address ignores those headers and needs its trusted-proxy setting. Remove whoami afterwards.
Wildcard certificates
A certificate for *.example.com cannot use the HTTP challenge. Tick Use DNS Challenge, pick your DNS provider and paste an API token restricted to that zone. From 2.16 on, those credentials are deleted from disk after certbot runs, and 2.17 changed several DNS plugins in breaking ways: read the release notes before upgrading if a wildcard depends on one.
Apps that run outside Docker
Inside the container, 127.0.0.1 means the proxy itself, and forwarding to it is the most common cause of a 502 error. For a service that runs directly on the host, add this to the npm service and forward to host.docker.internal:
extra_hosts:
- "host.docker.internal:host-gateway"
The service must listen on an address the container can reach, not only on 127.0.0.1, and the firewall must keep that port closed to the internet.
Lock down the panel
- Keep port 81 private. The SSH tunnel is the simplest gate. If you need the panel under a name, create a proxy host that forwards to
127.0.0.1port81and attach an Access List that allows only your own addresses. - One account per person. Give each colleague a user with only the Permissions they need, and check Audit Logs when a host changes unexpectedly.
- Guard apps that have no login. Access lists combine IP rules and basic authentication. From 2.16, a list can cover a single path of a host, such as
/admin. - Update promptly. Recent releases fixed real problems: 2.15.0 closed a flaw that let any authenticated user change their own roles, 2.16.0 invalidates login tokens issued before a password change, and 2.17.0 rate limits the authentication endpoints. A proxy that holds every certificate deserves updates within days.
- Rate limit sensitive paths. The interface has no field for it, but custom snippets work. Define a zone in
/data/nginx/custom/http_top.conf, which is loaded at the top of the http block:
limit_req_zone $binary_remote_addr zone=perip:10m rate=10r/s;
Then paste the limit into a host's Advanced tab:
limit_req zone=perip burst=20 nodelay;
limit_req_status 429;
The guide to handling and sending HTTP 429 explains how to size those numbers.
Back up, upgrade, roll back
The two folders are the whole state. Stop the container for a consistent copy of the SQLite file; it takes seconds:
cd /opt/npm
docker compose stop npm
tar czf "/root/npm-$(date +%F).tar.gz" data letsencrypt
docker compose start npm
The archive holds private keys, so encrypt it before it leaves the server, and keep one copy off the machine.
To upgrade, change the image tag to the new version, then pull and restart:
docker compose pull
docker compose up -d
docker compose logs --tail 50 npm
Some releases migrate the database, and the project warns that reverting one is not easy, so the archive is your rollback: restore both folders, set the previous tag and start again. Rehearse it once on a spare server.
When another proxy fits better
Nginx Proxy Manager keeps its configuration in a database edited through a browser: ideal for a handful of hosts, limiting beyond that. There is no file to review in Git, no template for fifty similar sites and no on-demand certificates for customer domains. At that point a proxy configured in text fits better. Caddy or Nginx as a reverse proxy compares the two, and how to host several websites on one VPS covers serving many sites.
Nginx Proxy Manager is also a one-click app on CloudSat; the proxy needs little memory, so the apps behind it decide the plan.
FAQ
What is the default login for Nginx Proxy Manager?
There is none in current releases. The first visit to the admin port shows a setup screen that creates the administrator, unless INITIAL_ADMIN_EMAIL and INITIAL_ADMIN_PASSWORD created one at startup. The admin@example.com and changeme pair in older tutorials applies to old versions only.
Why does my proxy host return 502 Bad Gateway?
The proxy cannot reach the upstream. Check that the forward hostname is the container name and not localhost, that the port is the one the app listens on inside its container, and that the app joined the shared network: docker network inspect proxy lists the members. An app that is still starting also returns 502 briefly.
Can it proxy TCP or UDP services?
Yes, with Streams, which forward raw TCP or UDP ports, for a game server or an MQTT broker for example. Each stream port must also be published in the Compose file and allowed in the firewall, because the stream listens inside the container.
Do I need MySQL or PostgreSQL?
Not for one proxy. SQLite needs no extra service and is backed up with the rest of ./data. MySQL, MariaDB and PostgreSQL are supported through DB_MYSQL_* or DB_POSTGRES_* variables, which makes sense only if you already run and back up one of them.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




