Introduction
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 calleddocker-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!