How to Install Nginx Proxy Manager with Docker

Nginx Proxy Manager (NPM) provides a web UI for managing reverse proxies and free Let's Encrypt SSL certificates — ideal for hosting several websites or applications on one VPS without hand-editing Nginx configuration files.

Prerequisites

  • Docker Engine and Docker Compose installed
  • A domain name pointing to your VPS
  • Root or sudo access

Step 1 — Create a Project Directory

mkdir ~/nginx-proxy-manager && cd ~/nginx-proxy-manager
mkdir data letsencrypt

Step 2 — Create docker-compose.yml

nano docker-compose.yml
services:
  app:
    image: jc21/nginx-proxy-manager:latest
    container_name: nginx-proxy-manager
    restart: unless-stopped
    ports:
      - "80:80"
      - "81:81"
      - "443:443"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

Step 3 — Start the Container

docker compose up -d

Step 4 — Allow the Admin Port Through the Firewall

sudo ufw allow 81/tcp

Step 5 — Access the Admin Panel

http://YOUR_SERVER_IP:81

Step 6 — Log In and Change the Default Credentials

Default login:

EmailPassword
[email protected]changeme

You'll be forced to set a new email and password immediately after first login — do not skip this.

Step 7 — Add a Proxy Host

  1. Go to Proxy Hosts → Add Proxy Host
  2. Enter your domain name
  3. Set the forward hostname/IP and port of your backend application (e.g. another container or 127.0.0.1:3000)
  4. Enable WebSocket Support if your app requires it
  5. Save

Step 8 — Enable Free SSL

  1. Edit the Proxy Host, open the SSL tab
  2. Request a new Let's Encrypt certificate
  3. Enable Force SSL and HTTP/2
  4. Save

Common Errors

Port 80/443 already in use:

sudo ss -tulpn | grep -E ':80|:443'

Stop any other web server (Nginx/Apache) running directly on the host before starting NPM.

Can't access port 81 — confirm the firewall rule was added: sudo ufw status.

SSL request fails — confirm your domain's DNS A record already points to this server's IP before requesting a certificate.

Best Practices

  • Change the default admin credentials immediately
  • Enable HTTPS (Force SSL) on every hosted domain
  • Back up the data and letsencrypt directories regularly

FAQ

Can I host multiple domains through one Nginx Proxy Manager instance?
Yes — that's its primary purpose; add a separate Proxy Host entry for each domain or subdomain.

Related Articles

  • How to Install Docker Compose on Ubuntu & Debian
  • How to Install Portainer for Web-Based Docker Management
  • Deploy WordPress with Docker Compose
  • nginx proxy manager, reverse proxy, docker ssl, lets encrypt docker
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Install Docker Engine on Ubuntu & Debian (Complete Guide)

Docker lets you package applications and their dependencies into lightweight, isolated containers...

How to Install Docker Compose on Ubuntu & Debian

Docker Compose lets you define and run multi-container applications from a single YAML file,...

Deploy Your First Docker Container: A Beginner's Walkthrough

With Docker installed, this hands-on walkthrough covers the core workflow you'll use constantly:...

How to Update Docker and Docker Compose Safely

Keeping Docker Engine and Compose updated brings security fixes, performance improvements, and...

Docker Compose Troubleshooting: Common Errors & Fixes

A reference guide to the Docker and Docker Compose errors you're most likely to encounter, with...