How to Install and Use NGINX Proxy Manager on Raspberry Pi
NGINX Proxy Manager is a powerful tool that allows you to manage and secure your web applications with ease. By running it on a Raspberry Pi, you can create a low-cost, efficient proxy server for your home or small business network. This guide will walk you through the steps to install and configure NGINX Proxy Manager on your Raspberry Pi.
Prerequisites
Before starting, ensure you have the following:
- Raspberry Pi (preferably Raspberry Pi 3 or later for better performance)
- MicroSD card with Raspberry Pi OS installed
- Stable internet connection
- Access to the command line (via monitor and keyboard or SSH)
- Docker and Docker Compose installed on your Raspberry Pi (Refer to the Docker on Raspberry Pi guide if needed)
Step 1: Update and Upgrade Your Raspberry Pi
First, make sure your Raspberry Pi is up to date.
- Open a terminal on your Raspberry Pi or SSH into it.
- Run the following commands to update and upgrade your system:
sudo apt update
sudo apt upgrade -y
Step 2: Install Docker and Docker Compose
If you haven't installed Docker and Docker Compose yet, follow these steps:
- Install Docker:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- Add Your User to the Docker Group:
sudo usermod -aG docker $USER
- Install Docker Compose:
sudo apt install -y python3-pip
sudo pip3 install docker-compose
- Reboot Your Raspberry Pi:
sudo reboot
Step 3: Set Up NGINX Proxy Manager
- Create a Directory for NGINX Proxy Manager:
mkdir ~/nginx-proxy-manager
cd ~/nginx-proxy-manager
-
Create a
docker-compose.yml
File:Create a
docker-compose.yml
file in the directory and add the following content:
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: always
ports:
- '80:80'
- '81:81'
- '443:443'
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "npm"
DB_MYSQL_NAME: "npm"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
db:
image: 'jc21/mariadb-aria:latest'
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'npm'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'npm'
volumes:
- ./data/mysql:/var/lib/mysql
- Deploy the Stack:
Deploy the Docker stack using Docker Compose:
docker-compose up -d
This command will download the necessary images and start the NGINX Proxy Manager and MariaDB containers.
Step 4: Access NGINX Proxy Manager
- Open Your Web Browser:
Open a web browser on your computer and navigate to http://<your_raspberry_pi_ip>:81
.
- Log In:
The default login credentials are:
-
Email:
[email protected]
-
Password:
changeme
- Change the Default Credentials:
After logging in, immediately change the default email and password to secure your NGINX Proxy Manager instance.
Step 5: Configure a Proxy Host
- Add a New Proxy Host:
- Click on "Proxy Hosts" in the menu.
- Click the "Add Proxy Host" button.
- Enter the domain name or IP address of the web service you want to proxy.
- Configure any additional settings as needed.
- Enable SSL:
- If you want to use SSL, go to the "SSL" tab.
- Choose "Request a new SSL Certificate".
- Fill in the required information and agree to the terms.
- Click "Save" to apply the settings.
- Save and Apply:
Click "Save" to create the proxy host. NGINX Proxy Manager will automatically configure NGINX and handle the SSL certificates.
Conclusion
By installing NGINX Proxy Manager on your Raspberry Pi, you can easily manage and secure your web applications with a user-friendly interface. Whether you're running a home server, a small business network, or just experimenting with web technologies, NGINX Proxy Manager provides a robust and flexible solution for managing your proxies. Follow these steps to get started and take control of your web traffic with NGINX Proxy Manager on your Raspberry Pi.