How to Install Nginx Proxy Manager
Nginx Proxy Manager (NPM) is a powerful tool that simplifies the process of managing Nginx proxy hosts. It provides a user-friendly web interface for handling SSL certificates, reverse proxy settings, and more. This guide will walk you through setting up NPM on your UGREEN NAS using either Docker Compose or SSH, ensuring a seamless and secure configuration.
WARNING
This guide was last tested for NPM v2.9.13
Option 1: Deploy Container Using Docker Compose
To quickly deploy Nginx Proxy Manager on UGREEN NAS, it is recommended to use Docker Compose for project management. This method is suitable when you need to create and manage multiple containers, making containerized management convenient.
1. Access the Docker Project Interface
In the UGOS Pro system of UGREEN NAS, open the "Docker" app, click "Project > Create" to start the project creation wizard.
2. Configure the Docker Compose File
In the wizard, you'll need to provide a Docker Compose configuration file. The Docker Compose file for NPM can be found here.
Details
- Specify the NPM Docker image to use. The
latesttag ensures that the most recent version is pulled. - Use the environment variable to set the container's time zone. This is essential for maintaining consistent timestamps for automated tasks and logs. You can adjust the time zone to match your location (e.g.,
America/ChicagoorEurope/Berlin).
3. Deploy the Project
After confirming that the configuration file is correct, click "Deploy Now". The system will automatically pull the image and start the container. Once the deployment is complete, you can access the NPM Webpage by visiting your-nas-name.local:8181 in your browser.
Option 2: Deploy Using SSH
If you prefer using SSH for more control over the setup process, follow these steps:
1. Connect to Your NAS via SSH
Open your terminal and connect to your UGREEN NAS using SSH:
ssh your-username@your-nas-ip2. Create a Directory for NPM
Create a new directory for NPM and navigate into it:
mkdir -p ~/npm
cd ~/npm3. Download the Docker Compose File
Download the Docker Compose file for NPM:
wget https://raw.githubusercontent.com/UGREEN-NASync/community-guide/refs/heads/main/docs/ugos/install/npm/compose.yaml4. Create an Environment File
Create a .env file to set the database passwords:
nano .envAdd the following lines to the .env file:
NPM_DB_PW= # use ' ' around the password if it contains special characters
NPM_DB_ROOT_PW= # use ' ' around the password if it contains special charactersSave and close the file.
5. Deploy the Container
Run the following command to deploy the container:
sudo docker compose up -dAccess the NPM Web Interface
After the deployment is complete, open the browser and enter the NAS IP address or name and port (e.g., 192.168.0.188:8181 or your-nas-name.local:8181) to access the interface. Use the default credentials to set up your admin account in NPM.
NOTE
The default login credentials for NPM are admin@example.com and changeme.
You should see a login page. Use the email address admin@example.com and the password changeme to log in. Options will be presented to you to be configured. Leave everything as default.
That's it! You now have a working NPM instance on your machine, congrats! 🎉
Adding Proxy Hosts
To add proxy hosts to your NPM instance, follow these steps:
- Navigate to
SSL Certificates, clickAdd SSL Certificate, and chooseLet's Encrypt. - Domain name =
*.domain.duckdns.org->Use DNS Challenge = True-> Agree to the ToS. - It is important to specify
*.YOUR_DOMAIN.comas this creates a wildcard certificate for any subsequent subdomain that gets created under the main domain name. - Choose DuckDNS (or appropriate) as your provider and paste in your Token to replace
your-duckdns-tokenin theCredentials File Content. - Save the SSL certificate.
- Navigate to "Hosts -> Proxy Hosts" and "Add Proxy Host".
- Specify a domain name such as
nextcloud.domain.duckdns.org. - Use
httpas a scheme (for most services) and enter your server's local IP address OR thecontainer_namein "Forward Hostname / IP" and the external port of the service (specified in the docker-compose.yaml) in "Forward Port". - Activate the toggles for "Block Common Exploits".
- Navigate to the "SSL" tab and choose the previously created wildcard certificate.
- Enable
Force SSL,HTTP/2 Support,HSTS enabled,HSTS subdomains. - Click save to save the new proxy host.
IMPORTANT
Make sure that the external HTTPS port that you specified for NPM in the docker-compose.yaml (e.g., 4443:443 OR 443:443 OR ANY_PORT:443) is forwarded by your router to your server. This should be the only open port on your router! DO NOT open the ports of the individual services directly on your router. This is the whole point of using a reverse proxy such as NPM!
Optional: Log Dashboard with GoAccess
This guide comes with an optional dashboard for NPM using GoAccess. To function correctly, it accesses the NPM logs as specified in the compose.yaml.
You can omit the log dashboard by deleting or commenting the GoAccess section in the compose.yaml:
services:
npm-app:
...
db:
...
# goaccess:
# ...