Ubuntu 22.04 Tutorials

How to Install Nginx Proxy Manager on Ubuntu 24.04 and Docker

Setting up Nginx Proxy Manager on Ubuntu 24.04 with Docker involves several steps, from installing Docker to configuring Nginx Proxy Manager. Follow these steps to get everything up and running smoothly.

Requirements for Installing Nginx Proxy Manager on Ubuntu 24.04 and Docker

Before you begin the installation of Nginx Proxy Manager on Ubuntu 24.04, ensure that your system meets the following requirements:

Ubuntu 24.04

System Requirements

  1. Operating System: Ubuntu 24.04 LTS Ubuntu 24.04 (Noble Numbat)
  2. User Privileges: A user account with sudo privileges
  3. CPU: At least 2 cores
  4. Memory: At least 2 GB of RAM
  5. Storage: At least 30 GB of free disk space

Software Requirements

  1. Docker: Docker must be installed on your system. This guide includes steps for installing Docker.
  2. Docker Compose: Docker Compose should be installed, which is included as a Docker plugin in this guide.
  3. Internet Connection: Required to download Docker, Docker Compose, and Nginx Proxy Manager images.

Network Requirements

  1. Open Ports: Ensure that the following ports are open and not being used by other services:
    • 80: HTTP
    • 443: HTTPS
    • 81: Admin Web Interface

Step 1: Install Docker

First, we need to install Docker using the official Docker repository to ensure we get the latest version.

Set up the Repository

Update the package list and install necessary packages:

sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release
sudo apt upgrade -y

Add Docker’s Official GPG Key

Create the keyrings directory and add Docker’s GPG key:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Set up the Stable Repository

Add the Docker repository to your sources list:

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

Install Docker Engine

Update the package list again and install Docker Engine and related packages:

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

Step 2: Verify Docker Installation

Ensure Docker is installed correctly and the service is running:

sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker

Step 3: Install Docker Compose

Since Docker Compose is now included as a Docker plugin, you can install it as follows:

sudo apt install docker-compose-plugin

Step 4: Verify Docker Compose Installation

Check that Docker Compose is installed correctly:

docker compose version

Step 5: Create Docker Network

Create the necessary Docker network for Nginx Proxy Manager:

sudo docker network create nginxproxymanager

Step 6: Create Project Directory

Create a directory to store the Nginx Proxy Manager files and navigate into it:

mkdir -p ~/nginx-proxy-manager
cd ~/nginx-proxy-manager

Step 7: Create docker-compose.yml File

Create the docker-compose.yml file with the following content: nano docker-compose.yml

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'  # Public HTTP Port
      - '443:443'  # Public HTTPS Port
      - '81:81'  # Admin Web Port
    environment:
      DB_MYSQL_HOST: 'db'
      DB_MYSQL_PORT: '3306'
      DB_MYSQL_USER: 'npm'
      DB_MYSQL_PASSWORD: 'your_secure_password'  # Replace with your secure password
      DB_MYSQL_NAME: 'npm'
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db
    networks:
      - default
      - nginxproxymanager

  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'your_secure_root_password'  # Replace with your secure root password
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'your_secure_password'  # Replace with your secure password
      MARIADB_AUTO_UPGRADE: '1'
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      - default
      - nginxproxymanager

networks:
  default:
    external:
      name: nginxproxymanager
  nginxproxymanager:
    external: true

Step 8: Run Docker Compose

Start Nginx Proxy Manager and MariaDB with the following command:

sudo docker compose up -d

Step 9: Access Nginx Proxy Manager

Once the containers are running, access the Nginx Proxy Manager web interface by navigating to http://<your-server-ip>:81 in your web browser.

Step 10: Initial Setup

Log in using the default credentials:

Make sure to change the default credentials after logging in.

Following these steps should help you install and configure Nginx Proxy Manager with MariaDB on your Ubuntu system. If you encounter any issues, provide the exact error messages for more targeted troubleshooting.

Conclusion

By following the steps outlined in this guide, you have successfully installed Nginx Proxy Manager on Ubuntu 24.04 using Docker. This setup allows you to easily manage your Nginx proxy configurations through a user-friendly web interface. The use of Docker ensures that your setup is portable and can be easily replicated or moved to another system. Remember to secure your installation by changing the default credentials and regularly updating your software to protect against vulnerabilities.


Discover more from Patrick Domingues

Subscribe to get the latest posts to your email.

author avatar
Patrick Domingues

Leave a Comment

Stay Informed

Receive instant notifications when new content is released.