How to Install Nginx Proxy Manager
Install Nginx Proxy Manager with Docker, add proxy hosts and free Let's Encrypt certificates, use DNS challenges for internal names, add access lists and avoid common mistakes.
What you'll build
Nginx Proxy Manager (NPM) puts a clean web UI on top of Nginx and Let's Encrypt. Instead of editing config files, you add "proxy hosts" through a dashboard and get automatic HTTPS certificates with a few clicks. It's the friendliest reverse proxy for beginners.
A reverse proxy accepts requests on ports 80 and 443 and forwards them to the right internal service based on the hostname. Instead of remembering 192.168.1.10:8096, you visit jellyfin.example.com, and you only expose one entry point. See the networking guide and the reverse proxy glossary entry for the background.
Prerequisites
- Docker and Docker Compose.
- A domain name with DNS you can edit.
- Ports 80 and 443 free on the server. If something else (another web server, or a previous proxy) uses them, stop it first.
- For public services: ports 80 and 443 forwarded from your router to the server. For internal-only services you do not need any forwarding if you use a DNS challenge (see Step 5).
Step 1: Deploy NPM
Create compose.yaml:
services:
npm:
image: jc21/nginx-proxy-manager:latest
container_name: npm
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "81:81" # admin UI
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
networks:
- proxy
networks:
proxy:
name: proxyThe proxy network lets NPM reach other containers by name when they join the same network (see the tip in Step 3). Start it:
docker compose up -dBy default NPM stores its settings in a small built-in database in ./data. You can use MariaDB instead, but for a home setup the default is fine as long as you back up the folder.
Step 2: Log in and secure the account
Open http://your-server-ip:81. Recent versions ask you to create the first admin user. Older versions use a default login, which you must change immediately:
- Email:
admin@example.com - Password:
changeme
Use a strong password, enable two-factor authentication under your user profile, and never expose port 81 to the internet. This account controls how traffic reaches all your services.
Step 3: Add your first proxy host
Go to Hosts → Proxy Hosts → Add Proxy Host:
- Domain Names:
jellyfin.example.com - Scheme:
http - Forward Hostname / IP: the internal IP of the service (for example
192.168.1.10) or, if the service shares theproxyDocker network, its container name (for examplejellyfin). - Forward Port: the service's internal port, e.g.
8096. - Enable Block Common Exploits and Websockets Support (needed by many apps).
Tip: if you forward to a container name, use the container's internal port, not the published host port. If you forward to the host's IP, use the published port.
Point that subdomain's DNS A record at your public IP before continuing (for public services), or at your server's LAN IP using your local DNS such as Pi-hole (for internal-only services).
Step 4: Add a free TLS certificate
On the SSL tab of the proxy host:
- Choose Request a new SSL Certificate.
- Enable Force SSL and HTTP/2.
- Agree to the Let's Encrypt terms and save.
NPM validates the domain and installs the certificate. Your service is now reachable over HTTPS with automatic renewal. Let's Encrypt has rate limits, so avoid repeatedly deleting and requesting certificates while troubleshooting.
Step 5: DNS challenge for wildcard or internal certs
If you'd rather not expose port 80, or you want a wildcard certificate (*.example.com), use a DNS Challenge. On the SSL tab choose "Use a DNS Challenge", pick your provider (for example Cloudflare), and paste an API token with permission to edit DNS records for that zone. This works even for services you never expose to the internet. You then keep a local DNS record that points the hostname at your server's private address, and the certificate is still valid and trusted.
Step 6: Add access control
For sensitive dashboards, create an Access List (Hosts → Access Lists) with username/password or IP allow-lists, then attach it to the proxy host. This adds a login prompt in front of apps that lack their own authentication. Restricting an admin tool to your LAN range is a quick, effective rule.
Step 7: Useful extras
- Custom locations — send
/apito a different service from/. - Advanced tab — add raw Nginx directives, such as larger upload limits for Nextcloud (
client_max_body_size 10G;). - Streams — forward raw TCP or UDP ports (for example for a game server).
- Redirection and 404 hosts — tidy up old hostnames.
Back up and update
Back up the data and letsencrypt folders; they contain every host and certificate. Update by pulling the image and recreating the container, and pin a version tag if you want controlled updates. See Docker basics for the workflow.
Security checklist
- Never expose the admin UI (port 81) to the internet.
- Use Force SSL on every host.
- Add access lists to admin panels.
- Keep the container image updated.
- Combine with Fail2ban and, ideally, a VPN for internal-only tools.
Troubleshooting
- Certificate request fails — DNS isn't pointing at your IP yet, or port 80 is blocked or already in use. Check from outside your network.
- Bad Gateway (502) — wrong forward IP/port, a wrong scheme (http vs https), or the target service is down. Test the target with
curlfrom the NPM container. - App loses connection / live features break — enable Websockets Support on the proxy host.
- Redirect loops with Cloudflare — set SSL mode to Full (strict) at Cloudflare and avoid forcing conflicting redirects.
- Large uploads fail — raise
client_max_body_sizein the Advanced tab.
Caddy instead?
If you prefer config-as-code, try Caddy, which also provides automatic HTTPS. NPM is best when you want to click, not type.
Next steps
Once your services are proxied, review the broader secure remote access guide to decide what should be public versus VPN-only.
Artículos relacionados
How to Set Up Caddy as a Reverse Proxy
Set up Caddy in Docker for automatic HTTPS in front of your homelab: Caddyfile examples, shared Docker networks, DNS-challenge certificates for internal names, auth, headers and troubleshooting.
How to Set Up WireGuard VPN
Self-host a WireGuard VPN to reach your homelab securely from anywhere: wg-easy in Docker, a manual wg-quick setup, split vs full tunnel, DNS, CGNAT and troubleshooting.
Cómo instalar Pi-hole
Bloquea anuncios y rastreadores en toda tu red instalando Pi-hole en tu servidor doméstico paso a paso.