Install Nginx Proxy Manager

Install Nginx Proxy Manager. Nginx Proxy is an intermediary server that can be used to forward content requests from different clients. This server is usually placed behind a firewall, with the aim of the firewall being able to filter all incoming packets before reaching the Main Server, or Content.

install nginx proxy manager

Also Read: Install Nginx Proxy Manager | Medium

Function

  • Load Balancer
  • Web acceleration
  • Security and Anonymity
What is Nginx Proxy Manager

It is a system that has a clean, efficient and easy to configure web interface.

Feature

  • Beautiful and Safe Admin Interface
  • Create forward, redirect and 404 Domains easily
  • Free SSL Let’s Encrypt or can be entered Certificate Commercial
  • User Management, Permissions and Audit Log

Configure Firewall

Before starting we should enable the firewall for the System

Ubuntu/Debian

Ubuntu/Debian uses System UFW as its default firewall

Cek firewall

ufw status

If it is not already active, use the following command to activate

ufw enable

Open the following Port 80,443,81,22(SSH).

ufw allow 81
ufw allow 80
ufw allow 443
ufw allow 22

Step 1 – Install Docker and Docker Compose

Nginx Proxy management runs using Containers, so we need a Docker and Dokcer Compose in the installation. Before installing Docker, you should first delete the old Docker. Skip this if it’s not there.

sudo apt-get remove docker docker-engine docker.io containerd runc

Then Install the Repository and All Dependencies for Install nginx proxy manager

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

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

Use the following command to set up the stable 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

Install Docker Engine

If the Repo and Docker dependencies have been added, now we can do the Docker installation. Update the package aptindex, and install the latest version of Docker Engine and containerd

apt-get update
apt-get install docker-ce docker-ce-cli containerd.io

Next Activate and Enable Docker

systemctl enable docker.service
systemctl start docker.service

And Check Docker Status, Running or not

systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-04-19 04:04:05 UTC; 21s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 22814 (dockerd)
Tasks: 10
Memory: 29.4M
CGroup: /system.slice/docker.service
└─22814 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Install Docker Compose

To deploy NPM (Nginx Proxy Manager), we use Docker Compose. Run the following command to download Current Stable Docker Compose

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

add Permission execute to binary

chmod +x /usr/local/bin/docker-compose

If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Check Installation

docker-compose --version
docker-compose version 1.29.2, build 5becea4c

Setup Nginx Proxy Manager

Our NPM (Nginx Proxy Manager) will run using a Docker Container which will be deployed using Docker Compose. Here we will create a Docker Compose File for with full permissions for Users.

NOTE: For this NPM we will install MySQL as the database which will run Nginx Proxy Manager.

Create File Dokcer Compose

First we will create a Docker Composer File, which is in YML Format.

nano docker-compose.yaml

Copy the following files

version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - '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: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      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

  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

Run the Docker Compose command

docker-compose up -d

To view the Containers that have been deployed using Docker Compose, use the following command

docker ps -a

Setup Nginx Proxy Manager WebUI

if it is finished, then we are now able to continue to access Nginx Proxy Manager using WebUI

Wait for the process to complete, If you open http://IP-Address, it will come out like the following picture

To create an Nginx Proxy Manager Admin Portal use Port 81. open in Browser http://IP-Address:81

install nginx proxy manager

Username : [email protected]
Password : changeme

Then it will appear like the following if you are logged in

install nginx proxy manager

Nginx Proxy Manager Acces WebUI

After the installation process is complete, we will do a trial. Here we set up a Virtualmin Server to do the Test. Virtualmin uses Private IP. Then create a Domain to do the Trial. “test.dixmata.com”

Create a Domain on Virtualmin

Then in the Nginx Proxy Manager, fill in the proxy as follows:

And the result is like the following picture

Open the Browser and Type the SubDomain or Domain that has been created in the Nginx Proxy Manager.

http://test.dixmata.com

Setting up Domain Name with SSL

To do Setting Domain with in Nginx Proxy Manager, Klik Host > Proxy Hosts

install nginx proxy manager

Then click “Add Proxy Host”

On Column “New Proxy Host”, fill in Domain with FQDN, IP Address and Port

Move on Tab “SSL” and fill it with as follows > “Save”

Choose “Request a new SSL Certificate” on the Drop Down Menu, then Activate “Force SSL” dan “HTTP/2 Support”, last input “Email address”. and Save

install nginx proxy manager

Control Access List Nginx Proxy Manager

In some cases you will allow the Application or Website only on Specific IP addresses. Nginx Proxy Manager is very supportive of this.

Here’s how to Configure the Nginx Proxy Manager Access List Control

Select on Tab “Acces Lists” >Click “Add Access List” > and Fill in the Name, Activate “Satiffy Any”

install nginx proxy manager

On Tab“Authorization”, fill in Username dan Password, to enter the Nginx Proxy Manager Server.

install nginx proxy manager

On Tab “Access”,Fill in the IP Address Whitelist, know what IPs are allowed to access the Nginx Proxy Manager Service

Now we have created the Nginx Proxy Manager Access List with the name “ACL”. Then next we will apply the ACL that has been created into the Proxy Host. Edit “Proxy Hosts”.

install nginx proxy manager

Later when we create the website, we will be asked for “Username” and “Password” authentication.

First of all, the documentation on how to install Nginx Proxy Manager and how to run it using the WebUI, this Proxy Manager can be used for redirection and porting services for websites or applications. May be useful.