Install Nginx Proxy Manager

It’s nice to have a place to test different software and network solutions. A home lab can be excellent for this process for any technician but it has its limitations. Most home internet connections will have a single IP address and depending out your ISP you might not have the option to get more. So how do you host different servers and get access to all of these from outside your network? You set up a reverse proxy. If you’re not familiar with proxy’s you can read more about it here. I will show you how to install Nginx Proxy Manager on Ubuntu server 18.04 using docker since this is the easiest way to set up and manage one for a home lab. View our step-by-step tutorial video below for a complete walk-through and/or view our step-by-step written instructions as well.

Install Ubuntu, update it, and install docker and docker compose.

sudo apt-get update
sudo apt install docker.io

Now install docker compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -m)" -o /usr/local/bin/docker-compose

update again
sudo apt-get update

and give docker compose executable permissions
sudo chmod +x /usr/local/bin/docker-compose

 

Create the directory and necessary files

We will now create a new directory named npm and within it we’ll create 2 files. These will be the config.json and docker-compose.yml.

Making and entering the directory

sudo mkdir npm
cd npm

Creating the 2 files

sudo nano config.json

copy and paste or type the following into this file.

{
  "database": {
    "engine": "mysql",
    "host": "db",
    "name": "npm",
    "user": "npm",
    "password": "npm",
    "port": 3306
  }
}

 

hit ctl+x to exit the file and click y to confirm and save the files under the same name

now lets create the second file

sudo nano docker-compose.yml

copy and paste or type the following into this file.

version: "3"
services:
  app:
    image: jc21/nginx-proxy-manager:2
    restart: always
    ports:
      # Public HTTP Port:
      - '80:80'
      # Public HTTPS Port:
      - '443:443'
      # Admin Web Port:
      - '81:81'
    environment:
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      # Make sure this config.json file exists as per instructions above:
      - ./config.json:/app/config/production.json
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db
  db:
    image: jc21/mariadb-aria:10.4
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql

 

Create  the containers

With both of these files created in the same directory now we’ll run the compose command to build the container. Make sure you run this command while you are in the same directory as the files.

docker-compose up -d

Log in with the default administrator user

We can now open a browser and go to the login page by visiting http://”serverIP”:81
Login using
Email: admin@example.com
Password: changeme

You will be asked to update the user information, make sure to also change the default password.