On this page
- What is Nginx Proxy Manager good for?
- What do you need before installing?
- How do you write the Compose file?
- Why is binding port 81 to localhost so important?
- How do you reach the admin panel?
- How do you publish an app with HTTPS?
- How do you upgrade and back up the stack?
- What should you check when something fails?
- Questions
What is Nginx Proxy Manager good for?
Nginx Proxy Manager is a web panel that writes Nginx reverse proxy configuration for you. You type a domain, the address of the app behind it and tick a box for HTTPS; the panel generates the server block, asks Let's Encrypt for a certificate and renews it later. It suits a server that hosts several self-hosted apps in containers, where editing raw Nginx files for each one would be tedious.
It does not replace knowing Nginx. When you need unusual caching, rate limits or complex rewrites, plain configuration files from the Nginx reverse proxy guide give more control. The panel also expects to own ports 80 and 443, so do not run a second web server on the host at the same time.
What do you need before installing?
Start from Ubuntu 24.04, 22.04 or Debian 12 or 13 with a sudo user, Docker Engine and the Compose plugin. The Docker Engine tutorial installs both from the official Docker repository; the Docker image gives you a server with them already in place. Confirm the tools respond:
docker --version
docker compose version
sudo ss -tlnp | grep -E ":(80|443) "The final command prints nothing. If Apache or Nginx already listen on those ports, stop and disable them with sudo systemctl disable --now nginx or apache2. Each domain you plan to publish needs A and AAAA records pointing at 198.51.100.24 and 2001:db8:4f2a::24, see DNS records.
How do you write the Compose file?
Create a folder for the stack and a single compose.yaml. The important line is the admin port mapping: binding it to 127.0.0.1 means only processes on the server itself can reach it.
mkdir -p ~/npm && cd ~/npm
nano compose.yamlservices:
npm:
image: jc21/nginx-proxy-manager:latest
container_name: npm
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "127.0.0.1:81:81"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
networks:
- proxy
networks:
proxy:
name: proxyThe data folder holds the panel database and generated configuration, and letsencrypt holds certificates, so both survive container upgrades. The named network proxy lets other stacks join and be reached by container name. Start it and watch the logs until the panel reports it is ready:
docker compose up -d
docker compose logs -f npmWhy is binding port 81 to localhost so important?
Docker writes its own packet filter rules for published ports, and those rules are evaluated before UFW sees the traffic. A mapping like "81:81" would expose the admin login to the whole internet even if ufw status shows port 81 as closed. Binding to the loopback address avoids that trap entirely.
Open only what the proxy needs in UFW, which still governs services that are not containers, such as SSH:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ss -tlnp | grep ":81 "The ss output should show 127.0.0.1:81, not 0.0.0.0:81. From another machine, curl -m 5 http://198.51.100.24:81 should time out or be refused. The firewall tutorial explains the rest of the OS firewall setup.
How do you reach the admin panel?
Open an SSH tunnel from your own computer, which forwards a local port to the loopback address on the server:
ssh -L 8181:127.0.0.1:81 deploy@198.51.100.24Keep that session open and browse to http://localhost:8181. Current releases ask you to create the first administrator on this screen. Older releases started with a built-in login of admin@example.com and changeme; if you see that, sign in and change both the email and password straight away. Then turn on a strong password in your password manager and close the tunnel when you are done.
If you would rather reach the panel over HTTPS on a name such as npm.example.net, create a proxy host for it that forwards to 127.0.0.1 port 81, and attach an access list that allows only your own IP address plus a username and password. The tunnel remains the safer default because the login page is never public.
How do you publish an app with HTTPS?
Run the app in a container on the same proxy network, then add a proxy host in the panel that points at the container name. A minimal test app shows the flow:
docker run -d --name hello --network proxy --restart unless-stopped traefik/whoamiIn the panel, open Hosts, then Proxy Hosts, then Add Proxy Host, and fill in:
- Domain names:
app.example.net - Scheme: http, Forward hostname:
hello, Forward port:80 - Tick Block common exploits, and Websockets support if the app uses them.
- On the SSL tab choose Request a new certificate, then enable Force SSL and HTTP/2.
Save, wait a few seconds, then test with curl -I https://app.example.net. A 200 response proves DNS, certificate and routing all work. Note that the app container publishes no ports of its own: only the proxy can reach it, which is exactly what you want.
How do you upgrade and back up the stack?
Upgrades are a pull and a recreate. Look at the project release notes first for any migration steps, then run:
cd ~/npm
docker compose pull
docker compose up -d
docker image prune -fAll state sits in ~/npm/data and ~/npm/letsencrypt. Archive those two folders on a schedule, for example with sudo tar czf ~/npm-backup-$(date +%F).tar.gz -C ~/npm data letsencrypt, and copy the archive off the server. The optional daily backups add-on covers the whole disk as a second layer; see daily backups.
What should you check when something fails?
- Certificate request fails: DNS does not point at the server yet, or port 80 is blocked. Check with
dig +short app.example.netand confirm port 80 is allowed. - 502 Bad Gateway: the forward host or port is wrong, or the app is not on the
proxynetwork. Rundocker network inspect proxyto list members. - Panel not loading through the tunnel: make sure the container runs with
docker compose psand that the tunnel points at127.0.0.1:81. - Changes not applied: read
docker compose logs npm; the panel logs Nginx test failures there.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Nginx Proxy Manager with Docker
Can I run Nginx Proxy Manager next to a normal Nginx on the host?
Not on the same ports. One of them must own 80 and 443. If you need both, move host Nginx to another port and proxy to it from the panel.
Does Nginx Proxy Manager support wildcard certificates?
Yes, through a DNS challenge. Choose the DNS challenge option on the SSL tab and enter an API token from your DNS host with permission to edit records.
Where are the generated Nginx files?
Inside ~/npm/data/nginx/, sorted by host type. Treat them as read only; the panel rewrites them on every save.
Can I proxy to a service running directly on the host rather than in a container?
Yes. Use the host address as seen from the container, such as the proxy network gateway, or add extra_hosts: ["host.docker.internal:host-gateway"] to the service and forward to host.docker.internal.
How much memory does it need?
The panel itself is light and runs on a 1 GB server. Size the plan for the apps behind it rather than for the proxy.
Is Traefik an alternative?
Yes. Traefik reads routes from container labels instead of a web form. Compare the two in the Traefik guide.
More in Web servers and proxies
- Install and configure Nginx
- Install and configure Apache
- OpenLiteSpeed web server
- HAProxy load balancer and TLS proxy
- Load balancing with Nginx upstreams
- Nginx as a reverse proxy for an app
- Apache as a reverse proxy
- Compression with gzip and Brotli
- HTTPS and www redirects
- Turn off Apache directory listings
- Nginx UI web interface
- Traefik for Docker containers
- Apache Tomcat for Java apps
- Encrypted FTP with vsftpd (FTPS)
- Varnish cache in front of a site