Getting started
Installation
By the end of this page NPG is running on your server and you are signed in to the admin UI with a new admin account.
Before you start
- A linux/amd64 or linux/arm64 server with Docker 24.0 or later and Docker Compose v2
- Ports 80, 443 (TCP and UDP) and 81 must be free on the server. If something else already uses 80 or 443, read "Changing ports" below first.
- If you plan to use the WAF, 2 GB of RAM or more is recommended.
- (Optional) A MaxMind account for country blocking. You enter it in the admin UI after installation.
Install
-
Create the install directory and download two files.
# 1. Create directory mkdir -p ~/nginx-proxy-guard && cd ~/nginx-proxy-guard # 2. Download files wget https://raw.githubusercontent.com/svrforum/nginxproxyguard/main/docker-compose.yml wget -O .env https://raw.githubusercontent.com/svrforum/nginxproxyguard/main/env.example -
Replace the database password and the application secret in
.envwith random values.# 3. Auto-generate secure secrets sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=$(openssl rand -base64 24)/" .env sed -i "s/JWT_SECRET=.*/JWT_SECRET=$(openssl rand -hex 32)/" .envTZin.envis the time zone used for logs and scheduled jobs. The downloaded file setsAsia/Seoul; change it if needed. -
Start the services.
# 4. Start services docker compose up -d -
Check that every container is running.
docker compose psYou should see
npg-proxy,npg-api,npg-ui,npg-dbandnpg-valkey. On the first start the database is prepared and the schema is created, so the admin UI can take a little while to come up.
Addresses
| Service | Address |
|---|---|
| Admin UI | https://<server address>:81 |
| HTTP proxy | http://<server address>:80 |
| HTTPS proxy | https://<server address>:443 |
The admin UI uses a self-signed certificate, so the browser shows a certificate warning on the first visit. Open port 81 with https://, not http://.
First sign-in
-
Sign in to the admin UI with username
adminand passwordadmin.
Sign-in screen -
The Initial Setup Required screen appears. Enter
adminas the Current Password, choose a New Username and a New Password, and click Save New Credentials.- The new username must be something other than
admin. - The new password must be at least 10 characters and contain an uppercase letter, a lowercase letter, a digit and a special character. Common passwords are refused.
- Email is optional. If you will later sign in to this account through SSO, enter the address your SSO provider holds. You can change it in the settings at any time.

Initial Setup Required screen: current password, new username and new password - The new username must be something other than
Until this step is done, the server refuses every other API request. That way nobody can take over a freshly installed instance with admin/admin before you do.
Worth setting up next
- Settings → GeoIP: enter your MaxMind Account ID and MaxMind License Key to enable country blocking and country information in the logs. NPG downloads and updates the database.
- Settings → SSL / ACME: put the address for certificate expiry notices in ACME Email.
- My Account → Two-Factor Auth: turn on two-factor authentication for the admin account.
Changing ports
The nginx container runs in host network mode, so the ports entries in docker-compose.yml cannot change 80 and 443. If another program already uses 80 and 443, as on Synology, put these values in .env and restart.
NGINX_HTTP_PORT=8080
NGINX_HTTPS_PORT=8443Your router then has to forward external ports 80 and 443 to 8080 and 8443 on the server, or Let's Encrypt HTTP-01 validation and outside access will not work.
Other port-related values:
| Variable | Default | Description |
|---|---|---|
UI_PORT | 81 | Host port of the admin UI |
API_HOST_PORT | 9080 | Loopback port nginx uses to reach the API. It must not clash with NGINX_HTTP_PORT. |
The full list is in Environment variables.
Running without Valkey
Valkey is optional. With REDIS_URL= (empty) in .env, the API keeps its cache and rate-limit counters in its own memory. To drop the valkey service as well, also remove the valkey entry under the api service's depends_on in docker-compose.yml, or docker compose refuses to start.
Common problems
npg-proxykeeps restarting. Most likely another program holds port 80 or 443. Look forbind() ... failedindocker logs npg-proxyand follow "Changing ports" above.- The admin UI does not open. Make sure the address starts with
https://. Ifdocker compose psshowsnpg-apistill starting, wait a little. - The Docker container list in the proxy host form is empty. On Synology and similar systems the Docker API version may not be detected. Set
DOCKER_API_VERSION(for example1.41) in.envand restart. - Synology Container Manager shows no logs for the NPG containers.
docker-compose.ymlpins the log driver tojson-file.docker logsstill works. To see the logs in DSM, comment out each service'slogging:block; log size limits then follow the Docker daemon's own settings. - You forgot the password. See Admin account recovery and 2FA.