• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
DefenceDev
No Result
View All Result
Home Solutions Docker

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

by neo
November 28, 2025
in Docker
0
Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

0
SHARES
203
VIEWS
Share on FacebookShare on LinkedIn
Table of Contents
  • Install Nginx Proxy Manager
  • Prerequisites
  • Steps to Install Nginx Proxy Manager with Docker on Pi4
    • 1. Create Project Directory for Nginx Proxy Manager on Your Pi4
    • 2. Create Docker Compose File
    • 3. Create the Environment File
    • 4. Start the Containers
    • 5. Access the Nginx Proxy Manager Web Interface
  • Conclusion

Install Nginx Proxy Manager

Managing reverse proxies, SSL certificates, and domain redirections can get complicated fast. Nginx Proxy Manager (NPM) makes it easy by providing a clean web interface on top of Nginx. This guide walks you through install Nginx Proxy Manager on a Raspberry Pi 4 running Ubuntu 22.04, using Docker and Docker Compose. You’ll be up and running in minutes.

If you’re looking to install Nginx Proxy Manager with Docker on a Raspberry Pi 4, this step-by-step guide covers everything you need.

Prerequisites

Make sure you have the following:

  • Raspberry Pi 4 with Ubuntu Server 22.04 (64-bit) installed
  • Internet connection
  • Docker and Docker Compose installed
  • Basic terminal experience

If Docker is not yet installed, you can check my post about it.

Steps to Install Nginx Proxy Manager with Docker on Pi4

1. Create Project Directory for Nginx Proxy Manager on Your Pi4

mkdir -p ~/nginx-proxy-manager
cd ~/nginx-proxy-manager

2. Create Docker Compose File

Create a docker-compose.yml file:


services:
  proxy:
    image: jc21/nginx-proxy-manager:latest
    container_name: nginx-proxy-manager
    restart: unless-stopped
    ports:
      - "80:80"
      - "81:81"
      - "443:443"
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "${MYSQL_USER}"
      DB_MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
      DB_MYSQL_NAME: "${MYSQL_DATABASE}"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db
    networks:
      - npm_network

  db:
    image: mariadb:10.5
    container_name: npm-mariadb
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
      MYSQL_DATABASE: "${MYSQL_DATABASE}"
      MYSQL_USER: "${MYSQL_USER}"
      MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      - npm_network

networks:
  npm_network:
    driver: bridge

3. Create the Environment File

Create a file named .env in the same folder as your docker-compose.yml:

# Root password for the MariaDB server (used only internally)
MYSQL_ROOT_PASSWORD=strong-root-password

# Database name and user credentials for Nginx Proxy Manager
MYSQL_DATABASE=npm
MYSQL_USER=npm
MYSQL_PASSWORD=secure-password

Tip: Always use strong passwords and never commit this file to version control (e.g., GitHub).

3.1 (Optional) Load Environment Variables

If your environment file is not named .env (e.g., it’s called docker-compose.env), you must load the variables manually before starting the containers:

set -a && source ./docker-compose.env && set +a

This command temporarily exports all environment variables from your docker-compose.env file into the shell session.
It ensures that Docker Compose can substitute them correctly in your docker-compose.yml.

4. Start the Containers

Now, start Nginx Proxy Manager with:

docker compose up -d

Check the running containers:

docker ps

You should see two containers running: nginx-proxy-manager and npm-mariadb.

5. Access the Nginx Proxy Manager Web Interface

Open your browser and go to:

http://<RaspberryPi-IP>:81

Login with the default credentials:

  • Email: admin@example.com
  • Password: changeme

You’ll be prompted to change them on first login.

Conclusion

You’ve successfully installed Nginx Proxy Manager on your Raspberry Pi 4 running Ubuntu 22.04, using Docker and Docker Compose. With a user-friendly web interface, managing reverse proxies, SSL certificates, and domain forwarding becomes fast and simple.

Now you can start adding your services and securing them with Let’s Encrypt SSL certificates with just a few clicks.

In upcoming blog posts, I will show you how I installed Nextcloud and WordPress on the same Raspberry Pi 4, and how I configured Nginx Proxy Manager to securely expose those services to the internet using custom domains and HTTPS.

Stay tuned for more Raspberry Pi self-hosting tutorials!

Tags: docker
Previous Post

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Next Post

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

neo

Related Posts

Install Portainer on Ubuntu 24.04 Using Docker Compose
Docker

Install Portainer on Ubuntu 24.04 Using Docker Compose

My Ultimate Docker Command Cheat Sheet (2025 Edition)
Docker

My Ultimate Docker Commands Cheat Sheet (2025 Edition)

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script
Docker

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)
Docker

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)
Docker

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04
Docker

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Next Post
Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Recommended

MikroTik: OpenVPN Client Failover Script

MikroTik: OpenVPN Client Failover Script

Nextcloud: Maintenance with OCC Command with Practical Examples

Nextcloud OCC Command Guide: Maintenance and Practical Use Cases

Maximizing Network Efficiency with AdGuard: My 7-Day Results

Maximizing Network Efficiency with AdGuard: My 7-Day Results

FortiGate Brute Force Protection: Ban IPs After Failed Admin Login

FortiGate Brute Force Protection: Ban IPs After Failed Admin Login

Install Portainer on Ubuntu 24.04 Using Docker Compose

Install Portainer on Ubuntu 24.04 Using Docker Compose

Categories

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos
  • Web Tools

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

Maximizing Network Efficiency with AdGuard: My 7-Day Results

Maximizing Network Efficiency with AdGuard: My 7-Day Results

FortiGate Brute Force Protection: Ban IPs After Failed Admin Login

FortiGate Brute Force Protection: Ban IPs After Failed Admin Login

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools

© 2025 defencedev.com - All rights reserved.