If you’ve ever set up your own Home Lab or VPS services, you must have run into this problem:
I have multiple services (Portainer, Halo, Alist) running on different ports (9000, 8090, 5244), but I want to access them using different subdomains of a single domain (like demo.com), and I want all of them to have the HTTPS green padlock.
Hand-writing Nginx configuration files (nginx.conf) is not only error-prone but also makes applying for and renewing SSL certificates extremely troublesome.
Today I recommend an amazing tool: Nginx Proxy Manager (NPM). It allows you to get all of this done in minutes via a graphical interface.
1. Why Choose Nginx Proxy Manager?
- Visual UI: All configurations are done by clicking around in a web browser.
- Automatic SSL: Built-in Let’s Encrypt support; one-click application and automatic renewal of certificates.
- Docker Deployment: Doesn’t pollute the host environment and can be migrated at any time.
Architecture Diagram
User (Browser) │ ▼[ Nginx Proxy Manager (Port 80/443) ] ────► [ Automatic SSL Management ] │ ├───► demo.com ────► [ Portainer (Port 9000) ] ├───► blog.demo.com ────► [ Halo Blog (Port 8090) ] └───► pan.demo.com ────► [ Alist (Port 5244) ]2. Docker Compose Deployment
First, ensure your server has Docker and Docker Compose installed.
Create a folder and create a new docker-compose.yml:
version: '3'services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '80:80' # HTTP Traffic - '81:81' # Admin Panel Entry - '443:443' # HTTPS Traffic volumes: - ./data:/data - ./letsencrypt:/etc/letsencryptStart the service:
docker-compose up -d3. Initial Configuration
- Access
http://<Your Server IP>:81. - Default login credentials:
admin@example.com, password:changeme. - Be sure to change your email and password immediately after your first login.
4. In Practice: Forwarding the Portainer Panel
Assume your Portainer is running at http://127.0.0.1:9000, and you want to access it via portainer.yourdomain.com.
- Add Proxy Host: Click “Proxy Hosts” -> “Add Proxy Host” on the Dashboard.
- Details Tab:
- Domain Names:
portainer.yourdomain.com - Scheme:
http - Forward Hostname / IP:
172.17.0.1(This is the Docker bridge’s host IP, or use the public IP) - Forward Port:
9000 - Check
Block Common Exploits(Basic protection).
- Domain Names:
- SSL Tab:
- SSL Certificate: Select “Request a new SSL Certificate”.
- Check
Force SSL. - Enter your Email and agree to the terms.
- Save: Click Save. Wait a few seconds, NPM will automatically verify the domain and request the certificate.
Done! Now you can access your panel via a secure HTTPS link.
Common Pitfalls and Troubleshooting
-
SSL Application Failed (Internal Error)
- Check Ports: You must ensure that your server firewall’s 80 and 443 ports are open to the public.
- DNS Resolution: Ensure your domain has correctly resolved to the server IP and has taken effect (can be checked using
ping). - Email Not Provided: When applying for a certificate, although the Email field is optional, it is recommended to fill it in; otherwise, Let’s Encrypt might reject the request.
-
502 Bad Gateway
- Incorrect IP Entry: In Forward Hostname, never enter
127.0.0.1(unless NPM’s network mode is set to host). - Correct Approach: Enter the Docker container’s LAN IP or the host machine’s internal IP (e.g.,
172.17.0.1).
- Incorrect IP Entry: In Forward Hostname, never enter
-
File Upload Limits
- The default Nginx configuration limits upload sizes. If you encounter failures uploading large files, you need to add this under the Proxy Host config -> Advanced in NPM:
client_max_body_size 0;
- The default Nginx configuration limits upload sizes. If you encounter failures uploading large files, you need to add this under the Proxy Host config -> Advanced in NPM:
5. Summary
Nginx Proxy Manager significantly lowers the barrier to entry for reverse proxying. For individual developers and home lab users, it perfectly balances ease of use and functionality, making it an essential piece of infrastructure.
If this article helped you, please share it with others!
Some information may be outdated





