Mad World #Save_GAZA: Free Palestine  

Search

Nginx Proxy Manager: Docker Compose Setup With Free SSL

Nginx Proxy Manager: Docker Compose Setup With Free SSL

Nginx Proxy Manager is a reverse proxy with a web interface. It runs in Docker, receives the visits to your domains on ports 80 and 443, sends each domain to the right app on your server, and gets free Let's Encrypt certificates for them. You add a site by filling in a form instead of writing nginx configuration files.

We installed version 2.17.1 with Docker Compose on 2 December 2026, on an Ubuntu 26.04.1 server with Docker 29.10.1. Then we put a test app behind it at test.nexaforge.si with a certificate from the Cloudflare DNS challenge, checked HTTPS from the command line, and reset the admin login from the database. Every screenshot below comes from that test.

Quick answer: Nginx Proxy Manager setup in six steps

  1. Install Docker Engine and the Docker Compose plugin.
  2. Save the docker-compose.yml file below in a folder and run docker compose up -d.
  3. Open http://your-server-ip:81 and create the admin account. Version 2.17.1 has no default login.
  4. For the certificate, either point the domain at your public IP address and forward ports 80 and 443 to the server (HTTP challenge), or create an API token at your DNS provider (DNS challenge, works with closed ports).
  5. Open Hosts > Proxy Hosts > Add Proxy Host and enter the domain, the app's container name and its port.
  6. In the SSL tab, choose Request a new Certificate and Force SSL, then Save.

What you need

  • A Linux server or home server with Docker. We used Ubuntu 26.04.1 LTS, Docker 29.10.1 and Docker Compose v5.8.1.
  • Ports 80 and 443 free on the server: Nginx Proxy Manager listens on them. Port 81 is its admin page.
  • A domain name. With the HTTP challenge, the domain must point at your public IP address and your router must forward ports 80 and 443 to the server. With the DNS challenge, you need an API token from your DNS provider instead. We used Cloudflare.

Step 1: Install Docker and Docker Compose

Install Docker Engine and the Compose plugin from Docker's own repository: our guide Install Docker Compose on Ubuntu shows each command. Then check both versions:

Terminal
docker --version
docker compose version
Terminal on an Ubuntu server: docker --version prints Docker version 29.10.1 and docker compose version prints Docker Compose version v5.8.1
1: Docker Engine. 2: the Compose plugin.

Step 2: Create the docker-compose.yml file and start it

Make a folder for Nginx Proxy Manager (we used ~/npm), save this file in it as docker-compose.yml, then start it from that folder:

YAML
services:
  app:
    image: 'jc21/nginx-proxy-manager:2.17.1'
    restart: unless-stopped
    ports:
      - '80:80'   # HTTP
      - '443:443' # HTTPS
      - '81:81'   # admin web interface
    environment:
      TZ: 'Etc/UTC'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

  whoami:
    image: 'traefik/whoami:v1.12.0'
    restart: unless-stopped
Terminal
docker compose up -d
Terminal: cat docker-compose.yml shows the app service (jc21/nginx-proxy-manager:2.17.1, ports 80, 443 and 81, two volumes) and whoami; docker compose up -d pulls both images and starts two containers
1: the compose file. 2: the first start pulls the images and starts both containers.

What each part does:

  • image: jc21/nginx-proxy-manager is the project's official image. Like the project's own example, the file pins version 2.17.1, so an update only happens when you change the tag.
  • ports: 80 and 443 receive the visits, 81 opens the admin page.
  • TZ: the time zone of the logs.
  • volumes: ./data keeps the database, the settings and the logs; ./letsencrypt keeps the certificates. Back up both folders: together they are your whole setup.
  • whoami: a tiny test app (traefik/whoami) that answers with the request it received. It proves that the proxy works; put your own apps in its place later.

The first start pulled the Nginx Proxy Manager image in 188 seconds on our connection, then both containers started in under two seconds.

Step 3: First login (there is no default login any more)

Open http://your-server-ip:81 in a browser. Version 2.17.1 has no default account: the first page says "Welcome! Get started by creating your admin account." and asks for a full name, an email address and a new password.

Nginx Proxy Manager 2.17.1 on port 81 at the first start: Welcome! Get started by creating your admin account, with the fields Full Name, Email address and New Password
1: your name. 2: the email address you will log in with. 3: the password.

The login [email protected] with the password changeme belongs to older releases; in 2.17.1 the first start asks you to create the account instead. To skip this page on a new install, the image can create the account from two environment variables, INITIAL_ADMIN_EMAIL and INITIAL_ADMIN_PASSWORD, described in the project's advanced configuration page.

After Save, the dashboard opens with no host yet:

Nginx Proxy Manager dashboard after the first login: 0 Proxy Hosts, 0 Redirection Hosts, 0 Streams and 0 404 Hosts, with the Hosts menu at the top
1: no proxy host yet. 2: the Hosts menu, where proxy hosts are added.

Keep port 81 for your own network: do not forward it on your router. If you need the admin page from outside, reach it through a VPN.

Step 4: Create a Cloudflare API token for the DNS challenge

Let's Encrypt only gives a certificate to someone who controls the domain, and it checks this in one of two ways. With the HTTP challenge, it connects to your server on port 80, so the server must be reachable from the internet. With the DNS challenge, Nginx Proxy Manager writes a temporary TXT record through your DNS provider's API, so the server can stay closed to the internet; it is also the only way to get a wildcard certificate. Our test server is not reachable from the internet, so we used the DNS challenge with Cloudflare, which hosts the domain's DNS.

  1. In the Cloudflare dashboard, open My Profile, then API credentials > API tokens, and click Create token.
  2. Give the token a name and pick the template Edit zone DNS.
  3. In the policy, keep Include, choose Specific zone and select your domain. The template's only permission is DNS: Edit.
  4. Choose an expiration, then click Continue to summary.
Cloudflare dashboard, Create token: name Nginx Proxy Manager DNS, zone policy Include, Specific zone, nexaforge.si, and in the DNS & Zones group the permission DNS set to Edit
1: a name you will recognize later. 2: one zone only. 3: DNS Edit, the only permission the DNS challenge needs.

The summary shows the zone and the permission before anything is created:

Cloudflare Token Summary: Nginx Proxy Manager DNS, expiration December 9, 2026, permission policy nexaforge.si DNS: Edit, all IP addresses allowed, and the Create Token button
1: the name and the expiry date. 2: what the token can do, and where. 3: create it.

Click Create Token and copy the token at once: Cloudflare shows it only once.

Cloudflare: Nginx Proxy Manager DNS API token was successfully created, with the token field, a copy button and the warning that the token will not be shown again
1: copy the token now: Cloudflare shows it only once.

We chose 7 days because we deleted the token after the test. On a real server, choose a longer period or none: Nginx Proxy Manager needs the token again at every renewal, and an expired token cannot renew the certificate. Never paste your Global API Key here: this token can only edit the DNS records of one zone.

Step 5: Add a proxy host

In Nginx Proxy Manager, open Hosts > Proxy Hosts and click Add Proxy Host. In the Details tab:

  1. Domain Names: type the domain (test.nexaforge.si in our test) and press Enter.
  2. Scheme http, Forward Hostname / IP whoami, Forward Port 80: where the app answers inside Docker.
  3. Turn on Block Common Exploits.
Nginx Proxy Manager, Add Proxy Host, Details tab: domain name test.nexaforge.si, scheme http, forward hostname whoami, forward port 80, Block Common Exploits turned on
1: the domain name visitors type. 2: the container that answers. 3: its port inside Docker. 4: a filter for common attacks.

The forward hostname is the service name because both services are in the same docker-compose.yml: Docker Compose put them in one network (npm_default in the output of Step 2), where each service name leads to its container. For an app in another compose file, add both containers to a shared Docker network, or use the server's IP address and the port the app publishes. Turn on Websockets Support for apps that need it, such as Home Assistant.

Step 6: Get a free SSL certificate with the DNS challenge

Open the SSL tab of the same form:

  1. SSL Certificate: Request a new Certificate.
  2. Turn on Force SSL and HTTP/2 Support.
  3. Turn on Use DNS Challenge and pick Cloudflare as the DNS Provider.
  4. In Credentials File Content, replace the example token after dns_cloudflare_api_token= with yours. Leave Propagation Seconds empty.
  5. Click Save.
Nginx Proxy Manager, SSL tab: Request a new Certificate, Force SSL and HTTP/2 Support on, Use DNS Challenge on, DNS Provider Cloudflare and the credentials file with the token line
1: a new Let's Encrypt certificate. 2: send plain HTTP visitors to HTTPS. 3: the DNS challenge. 4: your DNS provider. 5: the line that takes the API token.

The form warns that the credentials are stored as plain text in the database and in a file, one more reason to use a token that can only edit DNS. Leave HSTS off until HTTPS works on every name of the domain: once a browser has seen HSTS, it refuses plain HTTP for that name for as long as the header says, usually months.

Save took about a minute. The container's log shows why: on first use, Nginx Proxy Manager installed Certbot's Cloudflare plugin (20 seconds), then Certbot created the TXT record, waited 10 seconds for DNS propagation and received the certificate. The host then showed Online with a Let's Encrypt certificate:

Nginx Proxy Manager, Proxy Hosts: test.nexaforge.si to http://whoami:80 with SSL Let's Encrypt, access Public and the status Online
1: the new host, online with its certificate.

The Certificates page lists it with its provider and its expiry date, 90 days later:

Nginx Proxy Manager, Certificates: test.nexaforge.si, provider Let's Encrypt with Cloudflare, expires Mar 2, 2027, status In Use
1: the certificate and its expiry date, 90 days later.

Step 7: Check that HTTPS works

From a computer on the internet, open https://your-domain: the browser should show the app with a valid padlock. Our test server is not reachable from the internet, so we ran the checks on the server itself; the --resolve option of curl sends the domain to the local address 127.0.0.1. First, both containers must be up:

Terminal
docker compose ps --format 'table {{.Service}}\t{{.Image}}\t{{.Status}}'
Terminal: docker compose ps as a short table: app jc21/nginx-proxy-manager:2.17.1 Up 13 minutes, whoami traefik/whoami:v1.12.0 Up 13 minutes
1: both containers are up.

Then plain HTTP, HTTPS, and what the app behind the proxy receives:

Terminal
curl -sI --resolve test.nexaforge.si:80:127.0.0.1 http://test.nexaforge.si/
curl -sI --resolve test.nexaforge.si:443:127.0.0.1 https://test.nexaforge.si/
curl -s --resolve test.nexaforge.si:443:127.0.0.1 https://test.nexaforge.si/ | grep -E '^(Hostname|Host|X-Forwarded-Proto):'
Terminal: plain HTTP answers 301 with Location https://test.nexaforge.si/, HTTPS answers HTTP/2 200 from openresty, and whoami sees Host test.nexaforge.si and X-Forwarded-Proto https
1: HTTP sends visitors to HTTPS. 2: HTTPS answers 200 over HTTP/2. 3: the app behind the proxy sees the domain and the HTTPS scheme.

Plain HTTP answers 301 with Location: https://test.nexaforge.si/: Force SSL works. HTTPS answers HTTP/2 200 from openresty, the nginx build inside Nginx Proxy Manager. The whoami lines show what the app receives: the original Host and X-Forwarded-Proto: https, so an app behind the proxy knows that the visitor used HTTPS.

Last, the certificate itself:

Terminal
echo | openssl s_client -connect 127.0.0.1:443 -servername test.nexaforge.si 2>/dev/null | openssl x509 -noout -subject -issuer -dates
Terminal: openssl shows the certificate subject CN=test.nexaforge.si, the issuer Let's Encrypt, notBefore Dec 2 2026 and notAfter Mar 2 2027
1: a Let's Encrypt certificate for the domain, valid until 2 March 2027.

It is issued for CN=test.nexaforge.si by Let's Encrypt and is valid from 2 December 2026 to 2 March 2027.

Forgot password: reset the Nginx Proxy Manager login

Nginx Proxy Manager has no "forgot password" link and sends no reset email. With the SQLite database of the compose file above, you can make it ask for a new admin account: mark the existing users as deleted, then start it again. Run this in the folder that holds docker-compose.yml:

Terminal
docker compose stop app
sudo sqlite3 data/database.sqlite "SELECT id, email, is_deleted FROM user;"
sudo sqlite3 data/database.sqlite "UPDATE user SET is_deleted = 1;"
docker compose start app
Terminal: docker compose stop app, sqlite3 lists user 1 with is_deleted 0, an UPDATE sets is_deleted to 1 for every user, then docker compose start app
1: stop the app. 2: the users in the database. 3: mark them as deleted. 4: start the app again.

If sqlite3 is missing, install it first with sudo apt install sqlite3. The database file belongs to root because the container writes it, hence sudo.

Open port 81 again: the Welcome page is back. Create the new admin account:

After the reset, port 81 shows Welcome! Get started by creating your admin account again, with a name, an email address and a new password filled in
1, 2 and 3: a new admin account, as on the first start.

After the new login, the proxy host and its certificate were still there and online:

Proxy Hosts after the reset and the new login: test.nexaforge.si to http://whoami:80 is still listed, with Let's Encrypt and the status Online
1: the proxy host survived the reset.

The database keeps the old account, marked as deleted, and the site answers again over HTTPS:

Terminal
sudo sqlite3 data/database.sqlite "SELECT id, email, is_deleted FROM user;"
curl -sI --resolve test.nexaforge.si:443:127.0.0.1 https://test.nexaforge.si/ | head -1
Terminal: sqlite3 shows user 1 with is_deleted 1 and user 2 with is_deleted 0, then curl gets HTTP/2 200 from the site over HTTPS
1: the old account stays, marked as deleted; the new one is user 2. 2: the site answers again over HTTPS.

We tested this with the SQLite database only; a setup with MySQL, MariaDB or PostgreSQL needs that database's own client.

Nginx Proxy Manager vs Caddy vs Traefik

All three are reverse proxies that get Let's Encrypt certificates by themselves; they differ in how you set them up. This table comes from each project's documentation, and we tested only Nginx Proxy Manager here.

Nginx Proxy ManagerCaddyTraefik
Set up witha web interface on port 81a text file, the Caddyfilelabels on each container, or configuration files
HTTPSa certificate per host, requested in the interface (HTTP or DNS challenge)automatic for every site in the Caddyfileautomatic once a certificate resolver is set in its configuration
Best fora few apps, managed by clickinga few sites, with the configuration kept as textmany containers that start and stop often

Frequently asked questions

What is the default login for Nginx Proxy Manager?

There is none in version 2.17.1. On the first visit to port 81 you create the admin account with a name, an email address and a password. The pair [email protected] and changeme comes from older releases.

What ports does Nginx Proxy Manager use?

80 and 443 for the sites and 81 for the admin page, as in the ports of the compose file. Forward 80 and 443 on your router for the HTTP challenge; never forward 81.

Does Nginx Proxy Manager renew the certificates?

Yes: its documentation says it uses Certbot to issue and renew Let's Encrypt certificates. With the DNS challenge, the renewal uses the same API token, so the token must still be valid when the certificate is renewed.

Can Nginx Proxy Manager get a wildcard certificate?

Let's Encrypt issues wildcard certificates (such as *.example.com) only through the DNS challenge, which in Nginx Proxy Manager is the setup of Step 6. We requested a single name in this test.

Why does Nginx Proxy Manager show 502 Bad Gateway?

The proxy could not reach the app: the forward hostname or port is wrong, the app is stopped, or the two containers are not in the same Docker network. Compare the Details tab with the app's container name and the port it listens on inside the container.

How do I update Nginx Proxy Manager?

Back up the data and letsencrypt folders, change the version in the image line of docker-compose.yml, then run docker compose pull and docker compose up -d. The settings and certificates stay in the two folders.

How do I see the visitor's real IP address behind Nginx Proxy Manager?

Behind Cloudflare, the app first sees Cloudflare's addresses. Our guide Fix Nginx Proxy Manager Real IP Behind Docker and Cloudflare shows the settings that pass the real address through.

Sources

Yassine

Yassine runs IGPROD and has written about Synology NAS, Docker and self-hosting here since 2022. About IGPROD

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies Cookie Policy