install-nginx-proxy-manager-raspberry-pi-4-b
mayur-chavhan

How to install "Nginx Proxy Manager" on Raspberry Pi 4 [arm64]

Table of Contents

Overview:

In DevOps deployments Reverse Proxy is very common for port routing in backend applications. One of the popular is Traefik. Similar to Traefik there are HAproxy and Nginx.

HAproxy which is known for Server Load Balancer but also can be used as a reverse proxy.

Nginx is the fastest web server that can also be used as a reverse proxy for backend applications. 

Reverse-Proxy

All these three are excellent and popular reverse proxies used in servers but all these have one common problem: they need to write configuration files and it's not noobie server admin friendly since it involves years of experience to understand how exactly reverse proxy works. In Nginx and HAproxy, When you need to install SSL certificates for domai, It makes the configuration a little complicated and tiresome where in Traefik, It automatically handles domain certificates which makes Traefik awesome.

When i started learning Traefik it took few months for me to get a proper grip on its configuration and i learned on old Traefik version and when new Traefik versions came out then i have to read their documentation for new version changes plus then i have to added new changes to docker-compose file so my docker container can properly communicate with Traefik routing which adds big sigh for me. Don't get me wrong Traefik is still best for reverse proxy and if you can write Bash and Ansible Yaml scripts to automate with docker or backend applications then you're golden.Where "Jamie Curnow" aka "jc21" did all these three things in a single docker GUI application called "Nginx Proxy Manager '' In which you can easily bind backend applications without writing a single line of code. Which makes it easy enough for newbie server admin also for Developers who don’t need to learn reverse proxy complex configurations.

This installation can run same for any linux distros out there also docker image file also supports architecture for armhf and arm64 so it can easily run on Raspberry Pi 3B and 4B without any issue. I personally used Raspbian Lite for testing purpose and it works well.

Nnginx-Proxy-Manager
Nginx-Proxy-Manager

Prerequisite:

  1. Docker 
  2. Docker-Compose
  3. [Optional] Portainer

Step-1: Create folders.

sudo mkdir npman

Inside NPman folder create these three folders [data, data/mysql and letsencrypt] or run below command,

sudo mkdir -p npman/{data/mysql,letsencrypt}

Step-2: Create a file called "config.json"

paste below lines of code into it.

{
  "database": {
    "engine": "mysql",
    "host": "db",
    "name": "DBNAME",
    "user": "DBUSERNAME",
    "password": "DBPASSWORD",
    "port": 3306
  }

Step-3: Create Docker-Compose File

Now, Create a file called "docker-compose.yaml" and paste following code into it.

Source: https://github.com/jeff89179 [ Thanks to him]

 

version: '2'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      - '80:80'
      - '443:443'
      - '81:81'
    volumes:
      - './config.json:/app/config/production.json'
      - './data:/data'
      - './letsencrypt:/etc/letsencrypt'
    depends_on:
      - db
  db:
    image: 'yobasystems/alpine-mariadb:latest'
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: npman
      MYSQL_DATABASE: npman
      MYSQL_USER: npman
      MYSQL_PASSWORD: password
    volumes:
      - './data/mysql:/var/lib/mysql'
 Change MySQL password for production security purpose.

Step-5: Run Docker-Compose File

 

Run Docker-Compose command to download docker images and services,

sudo docker-compose up -d

If you have Portainer running then go into the Portainer UI, And in the Stacks, add a new stack named "NPMan" and paste above docker-compose code and deploy it.

After deployment check if container health and port are showing like this..

Portainer-Nginx-Proxy-Manager

Step-6: Login to NPMan dashboard

Go to browser and replace <<docker-host-server-ip>> to docker host server ip like this,

http://<<docker-host-server-ip>>:81/login

If everything goes right then enter below default credentials,

Credential for NPMan,

 

Email: [email protected]

Password: changeme

Visit our repository has all codes in this tutorial,

https://github.com/mayur-chavhan/Nginx-Proxy-Manager

 

Cheers!

Thank you for reading