492 words
2 minutes
Nginx Proxy Manager: A Comprehensive User Guide
2024-12-26

What Is Nginx Proxy Manager?#

Nginx Proxy Manager is an open-source tool for managing Nginx. It simplifies configuration and day-to-day management by giving you a web UI for handling multiple Nginx virtual hosts and reverse proxies.

TIP

Nginx Proxy Manager is commonly abbreviated as NPM — the same acronym as Node Package Manager, so watch the context to avoid confusion.

Why You Need Nginx Proxy Manager#

Exposing LAN services to the internet normally means port forwarding: punching a hole for each service. With more than a couple of services, that gets tedious and hard to manage — and every exposed port widens your attack surface. Nginx Proxy Manager lets you consolidate everything behind a set of managed reverse proxies instead.

Installation#

I installed it with docker-compose, using the following docker-compose.yml:

version: '3.8'
services:
nginx-proxy-manager:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '8880:80'
- '81:81'
- '8443:443'
volumes:
- ./nginx-proxy-manager/data:/data
- ./nginx-proxy-manager/letsencrypt:/etc/letsencrypt

Notes:

  • Port 81 is the NPM web UI, 80 is HTTP, and 443 is HTTPS.
  • On a home connection, ISPs typically block ports 80 and 443, so the ports are remapped as 80 -> 8880 and 443 -> 8443.
  • Data and certificates live in ./nginx-proxy-manager/data and ./nginx-proxy-manager/letsencrypt.
  • Adjust ports and paths to your liking.

Configuration#

Open http://127.0.0.1:81 in a browser. The default credentials are admin@example.com / changeme; you’ll be prompted to change the password on first login.

Requesting a Certificate#

  1. First, add your domain and request a certificate: SSL Certificates -> Add SSL Certificate -> Let's Encrypt
  2. Under Domain Names, enter your domain. You can request a wildcard certificate directly (e.g. *.mihouo.com), and put your email in Email Address for Let's Encrypt.
  3. Enable Use a DNS Challenge, pick your DNS provider under DNS Provider, and in Credentials File Content, replace dns_cloudflare_api_token with your own DNS token (my guide on getting one is in Using ddns-go for Dynamic DNS, in Chinese).
  4. Accept the Let's Encrypt terms, hit Save, and wait for the certificate to be issued.

Adding a Reverse Proxy#

  1. Hosts -> Proxy Hosts -> Add Proxy Host
  2. Under Domain Name, enter your (sub)domain. Using my alist service as an example: alist.mihouo.com
  3. Under Forward Hostname, enter your LAN service address — for the alist example, 192.168.2.2 — and set Forward Port to the service port, 5244 in my case
  4. The Cache Assets, Block Common Exploits, and Websockets Support toggles are optional — enable as needed.
  5. Under SSL, pick the certificate you just issued, enable Force SSL, and tweak the rest to taste. Click Save to finish.

Verification#

Open https://alist.mihouo.com:8443 in a browser — if everything is set up correctly, you should see the alist page.

alist behind NPM

TIP

Make sure the corresponding port is allowed through. If the config looks right but the page won’t load, check your firewall and security-group rules. On a home broadband connection, follow Port Forwarding to forward the internal port NPM maps to 443 out to whichever public port you want to use.

Final Thoughts#

Nginx Proxy Manager is a genuinely powerful reverse-proxy tool: it puts your LAN services behind clean domain names, handles certificate issuance for you, and only ever needs a single port opened to the outside world.

Nginx Proxy Manager: A Comprehensive User Guide
https://www.mihouo.com/en/posts/network/nginx-proxy-manager-a-comprehensive-user-guide/
Author
Jia
Published at
2024-12-26
License
CC BY-NC-SA 4.0