Once a home server has Jellyfin, Home Assistant and a wiki, remembering which service uses a port such as :8096 gets tiresome. A reverse proxy gives those services hostnames, while Nginx Proxy Manager supplies a web interface for the nginx configuration and Let’s Encrypt certificates. If you prefer a GUI to writing each server_name directive, it can make a handful of proxy hosts easier to manage. We’ll set up one service first, get its https:// connection working and then consider which others should be reachable.
Where the GUI Helps
A reverse proxy receives requests for several services at one address, terminates TLS and routes each hostname to its backend. That keeps the individual backend ports off the public router. Writing nginx server blocks by hand gives you control, but also brings directive inheritance and details such as the trailing slash in proxy_pass into the job. For a small home setup, a visual interface may be the configuration method you will maintain more comfortably.
Nginx Proxy Manager (NPM) generates those configurations from its web UI and uses Certbot with Let’s Encrypt, including DNS-challenge plugins for supported providers. Caddy and Traefik are sensible alternatives; choose NPM when visually managing a few hosts and certificates suits you. Advanced nginx behavior still needs deliberate configuration. Back up /data and /etc/letsencrypt rather than treating the generated files as a complete recovery plan.
What You Need Before You Start
This example uses a Linux Docker host and a domain whose public DNS you control. NPM’s current image supports amd64 and arm64; check that your NAS or Raspberry Pi can run the chosen image and Docker setup before borrowing the file below. The domain is part of this guide’s hostname and DNS-challenge design, rather than a claim that every public certificate must use a domain name.
- A Docker host with a static internal IP. Your services and NPM will live on the same network. Reserve a LAN address if your router will forward ports to it.
- A hostname under a domain you control. For the automated DNS-01 path, check that NPM supports your DNS provider and that your account can create the required public TXT records. A dynamic DNS hostname is useful only if its provider gives you the validation control your chosen method needs. Internal-only services can use names under your public domain and DNS-01 without opening an inbound web port; a private-only DNS name is a different certificate design.
- Port forwarding on your router. For HTTP‑01 challenges and public access, forward ports 80 (HTTP) and 443 (HTTPS) from your router’s WAN interface to the Docker host’s IP. If your ISP blocks port 80, use DNS-01 for certificate issuance, or choose an access design that does not need an inbound web port. Leave port 81 for the NPM admin UI — but don’t forward that to the internet unless you enjoy reading unauthorized access logs.
- Docker and Docker Compose installed. NPM runs as a container. If you haven’t installed Docker yet, follow the official installation instructions[1] for your Linux distribution. Membership in the
dockergroup grants root-level control of the host, so grant it only deliberately.
Decide on internal-only access before requesting certificates. It calls for a DNS provider with API support for DNS‑01 challenges, such as Cloudflare, DigitalOcean or Route53. NPM integrates several providers through its GUI, so check your provider while planning the hostname and certificate path.
Installing Nginx Proxy Manager with Docker Compose
A compose.yml file keeps the container’s configuration explicit and reproducible. Create a directory for NPM — say /opt/npm — and drop this file inside:
services:
app:
image: 'jc21/nginx-proxy-manager:2.16.0'
restart: unless-stopped
ports:
- '80:80' # HTTP
- '443:443' # HTTPS
- '127.0.0.1:81:81' # Admin UI, reachable via SSH tunnel on this host
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
The volume mounts are critical: ./data holds the SQLite database and nginx configs, ./letsencrypt stores certificates. Keep these on persistent storage. If you’re running on a NAS, map them to a folder outside the container’s ephemeral layer.
Start it with docker compose up -d and check the initialization logs; the database and keys need to be ready before login. Because the example binds the admin UI to host loopback, use an SSH tunnel from your computer (ssh -L 8181:127.0.0.1:81 user@host) and open http://127.0.0.1:8181. Complete the initial admin setup and choose a strong unique password; do not forward port 81. Use a maintained Docker release and verify reachability from another LAN device: Docker documents a localhost-publishing exposure affecting releases older than 28.0.0.
Your First Proxy Host: Exposing a Service
Before we touch SSL, let’s get a basic HTTP proxy working to understand the flow. I’ll use Home Assistant as an example, running on the same Docker host at http://192.168.1.50:8123.
In the NPM UI, go to Hosts > Proxy Hosts and click Add Proxy Host.
- Domain Names: Enter the FQDN you want, like
homeassistant.mydomain.com. You can add multiple names that point to the same backend. - Scheme:
http(the backend service is not HTTPS — NPM will handle TLS termination). - Forward Hostname / IP:
192.168.1.50(the Docker host’s IP, or the container’s name if NPM is on the same Docker network and you use the container name). - Forward Port:
8123. - Block Common Exploits: This optional NPM toggle adds a basic rule set; do not treat it as a substitute for patching or backend authentication.
- Websockets Support: If the service uses websockets (Home Assistant does), toggle it on. This enables the WebSocket proxy path; check the application if the connection still fails.
Home Assistant Container uses port 8123 by default; confirm the actual port for your installation. In current Home Assistant, its HTTP server settings are under Settings > System > Network. Enable Trust X-Forwarded-For and add the proxy address Home Assistant actually sees to Trusted Proxies; older releases use the corresponding HTTP YAML settings. Trust only the intended proxy address or range, not every client. The current HTTP documentation[2] explains the controls and the blocked-request behavior when a reverse proxy is not trusted. Save the NPM host and verify the connection on a trusted network. For a public host, complete HTTPS before entering credentials through the proxy.
Free SSL with Let’s Encrypt
The Compose file pins NPM 2.16.0, so use its certificate workflow rather than an older screenshot. In SSL Certificates, choose Add Certificate > Let’s Encrypt via HTTP and enter the hostname. NPM uses the email address on your user account for ACME registration; make sure that address is valid before requesting a certificate. The current backend accepts the Let’s Encrypt terms as part of the Certbot request, rather than showing the older per-request email and terms fields.
For HTTP-01, public DNS must point the hostname to the proxy’s reachable address and validation must reach port 80. NPM prepares a temporary webroot challenge, and Let’s Encrypt checks the token to establish domain control. If issuance fails, read the returned error before changing settings: a bad DNS answer, an unreachable port or an incorrect challenge response need different repairs. The Let’s Encrypt challenge reference[3] describes what the validator actually needs.
After issuance, edit the proxy host’s SSL tab, select that certificate and save the HTTPS settings:
- Force SSL: Redirect HTTP requests to HTTPS once the certificate and hostname work.
- HTTP/2 Support: Enable it if you want NPM to offer HTTP/2 on this TLS host; it does not fix backend reachability.
- HSTS Enabled: Leave this for after HTTPS is working reliably. The separate subdomains option expands the policy beyond one hostname, so consider the other services before enabling it.
Open https://homeassistant.mydomain.com and check the presented certificate, hostname and application connection. Issuing a certificate does not establish that the proxy routes to the right backend. NPM schedules renewals through Certbot; check expiry in SSL Certificates and inspect docker compose logs app plus Certbot’s files under /data/logs when a renewal fails. Don’t wait for the browser’s expiry warning to discover that DNS credentials stopped working.
When HTTP‑01 Fails: DNS‑01 Challenge
If your ISP blocks port 80, or you’re issuing a certificate for a hostname under your registered domain that resolves only on your LAN, you need DNS‑01 validation. NPM supports this via API credentials for several DNS providers.
In NPM 2.16.0, go to SSL Certificates > Add Certificate > Let’s Encrypt via DNS. Enter the domain names, choose the DNS provider and supply credentials in the format its plugin requires. For Cloudflare, use a token scoped to the relevant zone with Zone:DNS:Edit, as described by the Certbot Cloudflare plugin[4]. Keep those credentials out of screenshots and shared Compose files. On a successful request the plugin creates the validation TXT records, waits for propagation and removes the records afterward.
Assign the certificate to a matching proxy host through its SSL Certificate dropdown. DNS-01 also supports wildcard certificates: *.mydomain.com matches a single label such as wiki.mydomain.com, but neither the bare mydomain.com nor a deeper name such as a.wiki.mydomain.com. Request any additional names you need separately on the certificate; “wildcard” is not permission to stop checking hostname coverage.
Accessing Internal Services Securely Without Exposing Ports
Here’s a pattern for services that never need to be reached from the internet — like a local wiki or a Proxmox VE interface. I still want HTTPS and a proper hostname, but I don’t want to forward any ports. The trick: use a DNS‑01 wildcard certificate, and run a local DNS resolver (like Pi‑hole or Unbound) that resolves wiki.mydomain.com to NPM’s internal IP.
The browser asks your local resolver for the hostname, reaches NPM’s LAN address on port 443, and NPM connects to the backend. DNS-01 validation checks public DNS rather than making an inbound web connection to your server. NPM still needs outbound access to the ACME service and DNS provider API, the client must use your local DNS answer, and the proxy must be able to reach the backend. Keep router forwards closed for this design and check any other public access paths separately. HTTPS protects the connection; retain the application’s login and your intended LAN or VPN access limits.
Common Pitfalls and Troubleshooting
When a proxy host fails, trace DNS, the proxy and the backend separately. The checks below help identify which part needs attention before you start changing several settings at once.
Proxy Host returns 502 Bad Gateway. This means the proxy did not get a usable response from the backend; the cause could be addressing, network reachability, TLS or the application. Check that the Forward Hostname and Port are correct. If NPM and the service are on the same Docker host but not on the same Docker network, localhost or 127.0.0.1 won’t work — use the host’s LAN IP or the container’s name on a shared network. If you’re using a container name, ensure both containers are on the same user‑defined bridge network; the default bridge network does not provide the same container-name DNS as a user-defined bridge.
SSL certificate keeps failing. For HTTP‑01, verify that http://<your-domain>/.well-known/acme-challenge/ is reachable from the internet. NPM creates a temporary file there during validation. A 404 alone does not prove a validation failure when no challenge is active; inspect the actual Certbot error and verify DNS, port 80 reachability and challenge path during issuance. For DNS‑01, check the API credentials and that the DNS zone is correct. Use the provider’s documented propagation interval and NPM’s Propagation Seconds field where needed. Let’s Encrypt notes that DNS changes can require a substantial wait; lowering a TTL alone does not prove that every authoritative answer contains the new TXT record.
Websockets not working. The toggle in NPM enables the proxy’s WebSocket handling. If it still fails, inspect the browser connection and backend logs, and verify that the forward scheme and address match the application.
Admin UI exposed to the internet. By default, NPM listens on port 81 for its management interface. If you forwarded that port, stop immediately. Keep it on host loopback as in the Compose example, or put it behind a carefully controlled VPN; use the SSH tunnel for administration.
Going Further: Access Lists and Custom Locations
NPM includes two features that lift it above a simple port‑mapper. Access Lists let you define simple authentication rules — basic auth, IP whitelisting, or both — and apply them to any proxy host. To create one, go to Access Lists, add a new list, and specify allowed IP ranges or a username/password. Assign that list to the relevant proxy host and test from an allowed and a disallowed client. Basic authentication and IP allowlists do not replace the application’s own access control.
Custom Locations let you route a path such as /api to its own scheme, host and port. The location’s advanced configuration field accepts additional nginx directives when the application needs them, such as a deliberate timeout adjustment. Verify the generated location and the application’s path handling; a new forwarding target does not by itself fix URL rewriting.
Keeping the Configuration Recoverable
A GUI saves you from hand-editing routine proxy blocks; it doesn’t take over the host, DNS account or renewal failures. Compared with paying for managed ingress, the self-hosted option means you keep those jobs. When comparing costs, record your own hours per month for updates, renewal checks and recovery work alongside the managed option’s bill. There is no honest fixed time allowance that fits every homelab.
Name the backup strategy before adding more services: stop the NPM app for a consistent copy, save both ./data and ./letsencrypt together with compose.yml and the image version, and keep an encrypted copy outside this host. Those directories include account and certificate secrets. Rehearse restoring the paired directories on an isolated setup with the recorded version before treating the copy as a recovery plan. During routine troubleshooting, /data/nginx/proxy_host shows the generated proxy configurations; inspect those files to understand the GUI’s output, while keeping normal changes in the UI.