How to Set Up Nginx Proxy Manager on Ubuntu 24
Table of Contents
Nginx Proxy Manager is a powerful, open-source tool that simplifies the process of managing Nginx reverse proxies. It provides a user-friendly web interface for configuring proxies, SSL certificates, and more. Whether you’re hosting multiple websites or need a reverse proxy for your applications, Nginx Proxy Manager makes it easy to manage everything in one place.
In this guide, we’ll walk you through the steps to set up Nginx Proxy Manager on Ubuntu 24.
Prerequisites
Before you begin, ensure you have the following:
- A server running Ubuntu 24.
- A non-root user with
sudo
privileges. - Docker and Docker Compose installed (Nginx Proxy Manager runs in Docker containers).
Step 1: Update Your System
Start by updating your system to ensure all packages are up to date:
sudo apt update && sudo apt upgrade -y
Step 2: Install Docker and Docker Compose
Nginx Proxy Manager is typically deployed using Docker. If you don’t already have Docker installed, follow these steps:
Install Docker
- Install Docker using the official script:
curl -fsSL https://get.docker.com | sudo sh
- Add your user to the
docker
group to run Docker commands withoutsudo
:
sudo usermod -aG docker $USER
- Restart your session for the changes to take effect:
newgrp docker
- Verify the installation:
docker --version
Install Docker Compose
- Download the latest version of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- Make the binary executable:
sudo chmod +x /usr/local/bin/docker-compose
- Verify the installation:
docker-compose --version
Step 3: Set Up Nginx Proxy Manager On Ubuntu
Now that Docker and Docker Compose are installed, you can set up Nginx Proxy Manager.
Create a Directory for Nginx Proxy Manager
- Create a directory to store the configuration files:
mkdir ~/nginx-proxy-manager && cd ~/nginx-proxy-manager
- Create a
docker-compose.yml
file:
nano docker-compose.yml
- Add the following configuration to the file:
version: '3.8'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
container_name: nginx-proxy-manager
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
This configuration:
- Uses the official Nginx Proxy Manager Docker image.
- Maps ports 80 (HTTP), 81 (Admin UI), and 443 (HTTPS) to the host.
- Stores data and Let’s Encrypt certificates in local directories.
- Save and exit the file (
Ctrl + O
, thenCtrl + X
).
Step 4: Start Nginx Proxy Manager
- Start the Nginx Proxy Manager container using Docker Compose:
docker-compose up -d
This command will download the Docker image and start the container in detached mode.
- Verify that the container is running:
docker ps
You should see the nginx-proxy-manager
container listed.
Step 5: Access the Nginx Proxy Manager Web Interface
- Open your web browser and navigate to:
http://<your-server-ip>:81
Replace <your-server-ip>
with your server’s IP address.
- Log in with the default credentials:
- Email:
admin@example.com
- Password:
changeme
- After logging in, you’ll be prompted to change the default email and password.
Step 6: Configure a Reverse Proxy
Now that Nginx Proxy Manager is running, you can configure a reverse proxy for your applications.
Example: Proxy a Web Application
- In the Nginx Proxy Manager dashboard, click Hosts > Proxy Hosts > Add Proxy Host.
- Fill in the details:
- Domain Name: Enter the domain name you want to use (e.g.,
example.com
). - Scheme: Choose
http
orhttps
. - Forward Hostname/IP: Enter the IP address or hostname of the application you want to proxy.
- Forward Port: Enter the port number of the application.
- Click Save.
Enable SSL
- Go to the SSL tab for the proxy host.
- Select Let’s Encrypt and enter your email address.
- Enable Force SSL to redirect HTTP traffic to HTTPS.
- Click Save.
Step 7: Secure Your Installation
- Change Default Credentials: Ensure you’ve updated the default email and password for the Nginx Proxy Manager admin interface.
- Firewall Configuration: Allow only necessary ports (80, 443, and 81) through your firewall:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 81/tcp
sudo ufw enable
- Regular Updates: Keep Docker, Docker Compose, and Nginx Proxy Manager updated to the latest versions.
Conclusion
Nginx Proxy Manager is a fantastic tool for managing reverse proxies and SSL certificates with ease. By following this guide, you’ve successfully set up Nginx Proxy Manager on Ubuntu 24 and configured a reverse proxy for your applications. Whether you’re hosting multiple websites or managing internal services, Nginx Proxy Manager simplifies the process and provides a user-friendly interface.
For more advanced configurations, refer to the official Nginx Proxy Manager documentation.