Nginx Proxy Manager Setup on Debian 12

This guide intends to teach you the Nginx Proxy Manager Installation Setup with Docker and Connect to it via the Web Interface on Debian 12 Bookworm. Nginx Proxy Manager is a simple GUI tool that enables you to reverse proxy to web hosts with free TLS termination by using Nginx and Let’s Encrypt. With this tool, you can perform amazing tasks including:

  • Expose web services on the home network (or otherwise) easily and securely
  • Create proxy hosts, redirection hosts, streams, and 404 hosts without detailed knowledge of Nginx reverse proxy
  • Encrypt web traffic using free TLS certificates generated by Let’s Encrypt
  • Define access lists and set up basic HTTP authentication for the hosts

This guide will teach you to install and access Nginx Proxy Manager using Docker and Docker Compose on Debian 12 Bookworm. Now proceed to the following steps to start your setup.

Nginx Proxy Manager Installation Setup with Docker on Debian 12

Before you start your Nginx Proxy Manager setup, you need some requirements. Let’s see what we need.

Requirements

You must log in to your server as a non-root user with sudo privileges and set up a basic UFW firewall. To do this, you can use the Debian 12 Initial Setup Guide.

Because we want to use Docker to set up Nginx Proxy Manager, you must install Docker and Docker Compose on your server. For this purpose, you can check the following articles:

Docker CE Installation on Debian 12

Install Docker Compose on Debian 12

Also, you need a valid domain name that is pointed to your server’s IP address.

When you are done, proceed to the following steps to complete this guide.

Step 1 – Configure UFW Firewall Rules For Nginx Proxy Manager

At this point, you must allow ports 80, 443, and 81 through your Debian 12 firewall. First, check your UFW firewall status with the command below:

sudo ufw status

It must be activated:

Output
Status: active

Then, use the following command to open the desired ports:

# sudo ufw allow 80
# sudo ufw allow 81
# sudo ufw allow 443

Reload the firewall to apply the new rules:

sudo ufw reload

Note: To get UFW commands and rules, you can check Essential UFW Firewall Commands and Rules with Examples.

Step 2 – Create Docker Compose YAML File for Nginx Proxy Manager

At this point, you must create a Docker Compose YAML file for Nginx Proxy Manager on Debian 12 that is used to run your app.

First, create a directory for Nginx Proxy Manager:

mkdir ~/nginx-proxy

Then, switch to your directory and create data and SSL directories by using the commands below:

# cd ~/nginx-proxy
# mkdir {data,letsencrypt}

At this point, you can use your favorite text editors like Vi editor or Nano editor to create your Docker Compose YAML file:

vi docker-compose.yml

Add the following content to the file:


version: "3"
services:
  npm-app:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: npm-app
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "npm-db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment the line below if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - npm-db
    networks:
      - npm-nw
      - npm-internal

  npm-db:
    image: 'mariadb:latest'
    container_name: npm-db
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql
    networks:
      - npm-internal

networks:
  npm-internal:
  npm-nw:
    external: true


When you are done, save and close the file. Let’s see what is the meaning of the above parts in the file.

The first part of the file is where we import the Nginx proxy manager’s image and set some environment variables in the form of database credentials. We also expose ports 80, 81, and 443 to the server for access. You can expose more ports, such as 21, for FTP access. You can disable IPV6 support by uncommenting the line DISABLE_IPV6: ‘true’. We have mapped several directories from our host to the Docker for data and SQL storage.

We are using two networks here. One is the internal network npm-internal to connect the proxy manager and the database. This one is optional since it is automatically created. But here, we are doing it manually by giving it a name of our choice.

We have added an external network to the proxy manager container called npm-nw. This network is essential because you can use it to connect the proxy manager to any other docker containers you install. Using a network will allow you to connect any container directly without the need to expose its ports to the server.

Step 3 – Running Nginx Proxy Manager on Debian 12

At this point, the internal networks are automatically created. Now you must create the external network which is npm-nw. To do this, you can run the command below:

docker network create npm-nw
Example Output
44a18b35c24214bd17d58afe640e3563870a9f1ec3950bd4f1aa74528310b1e4

Next, you can run your Nginx Proxy Manager container on Debian 12 by using the following command:

docker compose up -d

Example Output:

Run Nginx Proxy Manager container on Debian 12

Now you can verify your Nginx Proxy Manager container is up and running with the command below:

docker ps

Example Output:

Check NPM container is running and active

Step 4 – Connect Nginx Proxy Manager Dashboard on Debian 12

At this point, you can easily connect to your Nginx Proxy Manager dashboard via the Web interface. From your desired web browser follow the URL below:

http://server-ip-address:81

You will see the Nginx Proxy Manager Login screen. Then, you can use the following credentials to sign in to your app:

Email address: [email protected] 

Password: changeme
Nginx Proxy Manager Login screen

Next, edit your admin user credentials and click Save.

Edit NPM user credentials

Change the default password and click Save.

Change default NPM password

At this point, you will see your Nginx Proxy Manager dashboard on Debian 12.

Nginx Proxy Manager dashboard

Step 5 – Domain Name and SSL Setup For Nginx Proxy Manager

At this point, you can configure your Domain name and SSL certificates for it. To do this, click on Hosts >> Proxy Hosts from the dashboard menu.

Add Proxy Host from Nginx Proxy Manager

Then, click on the Add Proxy Host button to continue.

Adding proxy host in NPM

Next, you need to enter your domain name, enter your server’s IP address as the forward hostname, and 81 as the forward port.

Add Domain name in NPM

Switch to the SSL tab. Select Request a new SSL Certificate from the dropdown menu. Select the options Force SSL and HTTP/2 support. If you want to enable HSTS, you can enable that as well.

Note: If you have your domain configured via Cloudflare, don’t enable the option Force SSL otherwise, you will be stuck in a redirection loop.

Enter your email address, agree to the Let’s Encrypt Terms of Service (TOS), and click the Save button to finish.

SSL setup in Nagin Proxy Manager

At this point, your SSL certificate for your domain is created and now you can access it through https://your-domain.

For more information, you can visit the official website.

Conclusion

With Nginx Proxy Manager you can easily create forwarding domains, redirections, streams, and 404 hosts, provide your own SSL certificates, advanced Nginx configurations, etc. You can easily use Docker and Docker Compose to set up Nginx Proxy Manager on Debian 12.

Hope you enjoy it. Also, you may like to read the following guides:

Configure Nginx Password Authentication on Debian 12

The smartctl Hard Drive Monitoring on Linux

Install Scala 3 Using Terminal on Debian 12

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!