Skip to main content

Setting Up Nginx Reverse Proxy Manager (NPM) on Ubuntu/Debian

Updated this week

Introduction

Nginx Proxy Manager (NPM) provides a simple, web-based interface for managing Nginx reverse proxies. It streamlines tasks like SSL certificate management, subdomain routing, and service exposure making it an ideal solution for self-hosters and administrators who want powerful capabilities without complex configuration. With Let's Encrypt integration and a user-friendly dashboard, NPM allows you to securely host multiple services behind a single IP address.

Prerequisites

Before proceeding, ensure you have the following:

  • A Debian-based system (Ubuntu 20.04+, Debian 11+)

  • Access to a user with sudo privileges

  • Docker and Docker Compose installed

  • A domain name pointed to your server’s IP address (via A/AAAA records)

  • Firewall ports 80 and 443 open to the internet

  • Basic understanding of the command line and DNS records

Setup

1. Update System

Start by updating the package list and upgrading existing packages:

sudo apt update && sudo apt upgrade -y

2. Install Docker and Docker Compose

2.1. Add Docker GPG key & repository to Apt (Ubuntu):

sudo apt-get update

sudo apt-get install ca-certificates curl

sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

2.1. Add Docker GPG key & repository to Apt (Debian):

sudo apt-get update

sudo apt-get install ca-certificates curl

sudo install -m 0755 -d /etc/apt/keyrings

sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc

echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

2.2. Install Docker

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3. Create NPM Docker Compose Directory

Make a new directory for your NPM setup and navigate into it:

mkdir -p ~/npm && cd ~/npm

4. Create docker-compose.yml File

Create a file using your preferred editors such as Nano ar Vim. This configuration defines the NPM app and its MariaDB backend along with necessary credentials and ports.

services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '443:443'
- '81:81'
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "npm"
DB_MYSQL_NAME: "npm"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db
db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'npm'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'npm'
MARIADB_AUTO_UPGRADE: '1'
volumes:
- ./mysql:/var/lib/mysql

Replace passwords with strong, secure passwords.

5. Start NPM

This command pulls the images and starts NPM and its database in detached mode.

docker compose up -d

6. Access the Web UI

The dashboard gives you full control over proxies, certificates, and user settings.

Open your browser and navigate to http://<your-server-ip>:81

Login using the default credentials:

You'll be prompted to change them immediately.

Now you are ready to create your first proxy! Change credentials and go to “Dashboard” -> “Add Proxy Host”.

Write the domain name, choose scheme on which your current web application is working, server’s IP address and it’s port. Check “Block Common Exploits” and set it for SSL certificate to be issued. Be aware, your domain needs to be pointed to your server’s IP address!

Conclusion

Setting up Nginx Proxy Manager on Ubuntu or Debian provides a streamlined, secure, and scalable solution for managing self-hosted services behind a modern reverse proxy. With Docker simplifying deployment and updates, and NPM's intuitive web interface making SSL and domain routing accessible to all skill levels, this setup is ideal for homelabs, small businesses, or production environments alike. Whether you're hosting a few apps or many, NPM on a Debian-based system delivers powerful features with minimal effort.

Did this answer your question?