Ubuntu Server NginxProxyManager Docker install

Ubuntu Server NginxProxyManager Docker install

September 4, 2021 0 By Tobias

The NginxProxyManager makes it possible to make different services accessible under the same port. (e.g. Different web servers). In addition, you can easily create Letsencrypt certificates.

What is required?

You will need Ubuntu Server and the Docker Engine and Docker Compose. You can learn how to install them here:

Now we create the directory for the NginxProxyManager Docker.

mkdir npm

cd npm

There are two variants how to install the NginxProxyManager. Once with an extra Maria DB Docker as database server, or with sqlLite. I would generally recommend the sqlLite installation. For the NginxProxyServer as good as no database performance is needed.

Install NginxProxyManager with sqlLite as Docker Compose

In the directory created above, we now need to create the Docker Compose file:

nano docker-compose.yaml

And then insert the following:

version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # Public HTTP Port:
      - '80:80'
      # Public HTTPS Port:
      - '443:443'
      # Admin Web Port:
      - '81:81'
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      # These are the settings to access your db
      # If you would rather use Sqlite uncomment this
      # and remove all DB_MYSQL_* lines above
      DB_SQLITE_FILE: "/data/database.sqlite"
      # 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

With CTRL + X we save the file. To start the container we execute this command:

docker-compose up -d

Install NginxProxyManager with MariaDB as Docker Compose

In the directory created above, we now need to create the Docker Compose file:

nano docker-compose.yaml
version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # Public HTTP Port:
      - '80:80'
      # Public HTTPS Port:
      - '443:443'
      # Admin Web Port:
      - '81:81'
    environment:
      # These are the settings to access your db
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "changeuser"
      DB_MYSQL_PASSWORD: "changepass"
      DB_MYSQL_NAME: "npm"
      # If you would rather use Sqlite uncomment this
      # and remove all DB_MYSQL_* lines above
      # DB_SQLITE_FILE: "/data/database.sqlite"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data/nginx-proxy-manager:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db
  db:
    image: yobasystems/alpine-mariadb:latest
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: "changeme"
      MYSQL_DATABASE: "npm"
      MYSQL_USER: "changeuser"
      MYSQL_PASSWORD: "changepass"
    volumes:
      - ./data/mariadb:/var/lib/mysql

Here, of course, the passwords must be changed. For this you can use the password generator. With CTRL + X we save the file. To start the container we execute this command:

docker-compose up -d

Is the Docker(s) ready installed and started. The web interface is accessible under: IP:81. Default login data:

Email:    [email protected]
Password: changeme
Share