How to install Nginx Proxy Manager with Docker Compose on Ubuntu 22.04

Step 1: Update the package list and install the required packages

sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Step 2: Import Docker official GPG Key to your system

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 3: Update the package list again and install Docker Compose

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

Step 4: Create a folder called nginx in your home directory

cd ~
mkdir nginx

Step 5: Move to your Nginx Proxy Manager folder and create a docker-compose.yml

cd nginx
sudo nano docker-compose.yml

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    networks:
      - npm
networks:
  npm:
    name: npm_network

Press Ctrl + X to save the file.

Step 6: Execute the container in the background

sudo docker compose up -d

Step 7: Log in to the Admin interface.

Replace your_ip with your IP. http://your_ip:81/

The default user and password are:

Email:    [email protected]
Password: changeme

You have to change the admin email and password after the first login. Congratulation, you have installed Nginx Proxy Manager successfully.