UbuntuUbuntu Based

How To Install Nginx Proxy Manager on Ubuntu 24.04 LTS

Install Nginx Proxy Manager on Ubuntu 24.04

Nginx Proxy Manager is a powerful and user-friendly tool that simplifies the process of managing reverse proxies for web applications. As websites and web services continue to grow in complexity, the need for efficient reverse proxy solutions becomes increasingly important. Ubuntu 24.04, the latest long-term support release of the popular Linux distribution, provides an excellent platform for hosting Nginx Proxy Manager.

In this comprehensive guide, we’ll walk you through the step-by-step process of installing Nginx Proxy Manager on Ubuntu 24.04. By the end of this tutorial, you’ll have a fully functional reverse proxy system that can handle multiple domains, SSL certificates, and advanced routing configurations with ease.

Prerequisites

Before we begin the installation process, ensure that you have the following prerequisites in place:

  • A server running Ubuntu 24.04 LTS with at least 1GB of RAM and 20GB of storage space
  • Root or sudo access to the server
  • A domain name pointed to your server’s IP address (for accessing the Nginx Proxy Manager web interface)
  • Basic familiarity with the Linux command line

It’s important to note that while these are the minimum requirements, for optimal performance in a production environment, you may want to consider allocating more resources based on your specific needs and traffic expectations.

Update and Upgrade Ubuntu System

Before installing any new software, it’s crucial to ensure that your Ubuntu system is up-to-date. This helps prevent potential conflicts and ensures you have the latest security patches. Open a terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

These commands will update the package lists and upgrade all installed packages to their latest versions. The -y flag automatically answers “yes” to any prompts during the upgrade process.

Install Docker

Nginx Proxy Manager runs in a Docker container, so our first step is to install Docker on Ubuntu 24.04. Docker is a platform that allows you to run applications in isolated environments called containers, making it easier to deploy and manage software.

Follow these steps to install Docker:

  1. Install required packages:
    sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
  2. Add Docker’s official GPG key:
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  3. Add the Docker repository:
    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
  4. Update the package database:
    sudo apt update
  5. Install Docker:
    sudo apt install docker-ce docker-ce-cli containerd.io -y

After installation, verify that Docker is running correctly by executing:

sudo systemctl status docker

You should see output indicating that the Docker service is active and running.

Install Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. We’ll use it to manage the Nginx Proxy Manager container. Install Docker Compose with these commands:

sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Verify the installation by checking the Docker Compose version:

docker-compose --version

You should see the version number of Docker Compose displayed in the terminal.

Create Docker Compose File for Nginx Proxy Manager

Now that we have Docker and Docker Compose installed, we need to create a Docker Compose file that defines the Nginx Proxy Manager container and its configuration. This file will specify the image to use, port mappings, and volume mounts.

Create a new directory for Nginx Proxy Manager and navigate to it:

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

Create and edit the docker-compose.yml file using your preferred text editor. Here’s an example using nano:

nano docker-compose.yml

Copy and paste the following content into the file:

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
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql

Save the file and exit the text editor. This configuration sets up two containers: one for Nginx Proxy Manager and another for its database (MariaDB).

Deploy Nginx Proxy Manager

With the Docker Compose file in place, we can now deploy Nginx Proxy Manager. Run the following command in the directory containing the docker-compose.yml file:

sudo docker-compose up -d

The -d flag runs the containers in detached mode, allowing them to run in the background. Docker will pull the necessary images and start the containers.

To check if the containers are running correctly, use:

sudo docker-compose ps

You should see two containers listed as “Up” in the status column.

Access Nginx Proxy Manager Web Interface

Once the containers are running, you can access the Nginx Proxy Manager web interface. Open a web browser and navigate to:

http://your_server_ip:81

Replace your_server_ip with the actual IP address of your Ubuntu server. You’ll be greeted with the login page for Nginx Proxy Manager.

For the initial login, use these default credentials:

  • Email: admin@your-domain.com
  • Password: changeme

After logging in, you’ll be prompted to change the default email and password. Make sure to choose a strong, unique password to secure your Nginx Proxy Manager installation.

Install Nginx Proxy Manager on Ubuntu 24.04 LTS

Configure Nginx Proxy Manager

Now that you’re logged into the Nginx Proxy Manager web interface, you can start configuring your proxy hosts. Here’s how to add a new proxy host:

  1. Click on “Proxy Hosts” in the sidebar menu.
  2. Click the “Add Proxy Host” button.
  3. Fill in the details:
    • Domain Names: Enter the domain name(s) for your website.
    • Scheme: Choose HTTP or HTTPS for the backend server.
    • Forward Hostname / IP: Enter the IP address or hostname of your backend server.
    • Forward Port: Specify the port your backend server is listening on (e.g., 80 for HTTP, 443 for HTTPS).
  4. Configure SSL settings if needed.
  5. Set up any additional options like caching or websockets support.
  6. Click “Save” to create the proxy host.

Repeat this process for each website or application you want to proxy through Nginx Proxy Manager.

Managing Proxy Hosts

Nginx Proxy Manager makes it easy to manage your proxy hosts. Here are some common tasks:

  • To edit an existing proxy host, click on the edit icon next to its entry in the Proxy Hosts list.
  • To delete a proxy host, click on the delete icon and confirm the action.
  • You can enable or disable proxy hosts using the toggle switch in the “Enabled” column.

Remember to always test your configuration after making changes to ensure everything is working as expected.

SSL Certificate Management

One of the great features of Nginx Proxy Manager is its built-in SSL certificate management. To set up SSL for a proxy host:

  1. Go to the “SSL Certificates” section in the sidebar.
  2. Click “Add SSL Certificate”.
  3. Choose between “Let’s Encrypt” for free, auto-renewing certificates, or “Custom” to upload your own certificates.
  4. For Let’s Encrypt:
    • Enter the domain names you want to secure.
    • Provide a valid email address for renewal notifications.
    • Agree to the Let’s Encrypt Terms of Service.
  5. Click “Save” to generate and install the certificate.

Once the certificate is created, you can assign it to your proxy hosts by editing them and selecting the appropriate certificate in the SSL section.

Backup and Restore

Regular backups are crucial for any system. To backup Nginx Proxy Manager data:

  1. Stop the Docker containers:
    sudo docker-compose down
  2. Create a backup of the data directory:
    sudo tar -czvf npm_backup_$(date +%Y%m%d).tar.gz ~/nginx-proxy-manager
  3. Restart the containers:
    sudo docker-compose up -d

To restore from a backup, stop the containers, replace the data directory with the backed-up version, and restart the containers.

Updating Nginx Proxy Manager

To update Nginx Proxy Manager to the latest version:

  1. Navigate to the directory containing your docker-compose.yml file.
  2. Pull the latest images:
    sudo docker-compose pull
  3. Update and restart the containers:
    sudo docker-compose up -d

Always check the Nginx Proxy Manager GitHub repository for any specific update instructions or breaking changes before updating.

Troubleshooting Common Issues

If you encounter issues with Nginx Proxy Manager, try these troubleshooting steps:

  • Check container logs: sudo docker-compose logs
  • Verify network connectivity: Ensure your firewall allows traffic on ports 80, 81, and 443.
  • Restart containers: sudo docker-compose restart
  • Check for conflicting services: Make sure no other services are using ports 80, 81, or 443 on your server.

Congratulations! You have successfully installed Nginx Proxy Manager. Thanks for using this tutorial for installing Nginx Proxy Manager on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Nginx website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button