Simplify Your Web Services: An Introduction to Nginx Proxy Manager

Simplify Your Web Services: An Introduction to Nginx Proxy Manager

Good morning everyone, Dimitri Bellini here from Quadrata! While my channel often dives deep into the world of Zabbix and open-source monitoring, today I want to shift gears slightly. I’ve realized that some foundational concepts, while powerful, aren’t always common knowledge, and sharing them can be incredibly helpful.

This week, we’re exploring Nginx Proxy Manager. It’s not a revolutionary concept in itself, but it’s a tool that significantly simplifies managing access to your web services, especially when dealing with HTTPS and multiple applications behind a single IP address.

What Exactly is Nginx Proxy Manager?

At its core, Nginx Proxy Manager is a reverse proxy built on top of the popular Nginx web server. But what makes it special? It packages several essential functionalities into one easy-to-manage solution, accessible via a clean web interface.

Here are its main characteristics:

  • Reverse Proxy Functionality: It acts as an intermediary, allowing you to securely expose multiple internal web services (like your Zabbix frontend, internal wikis, etc.) to the internet using potentially just one public IP address. Instead of exposing your services directly, the proxy handles incoming requests and forwards them appropriately.
  • Free SSL Certificates with Let’s Encrypt: It seamlessly integrates with Let’s Encrypt, enabling you to obtain and, crucially, automatically renew free, trusted SSL/TLS certificates for your domains. This makes setting up HTTPS incredibly straightforward.
  • User-Friendly Web Interface: This is a huge plus! While configuring Nginx via text files is powerful (Infrastructure as Code!), it can be complex and time-consuming, especially if you don’t do it often. The web UI simplifies creating proxy hosts, managing certificates, and viewing logs, making it accessible even if you’re not an Nginx expert. Remembering complex configurations months later becomes much easier!
  • Docker-Based: It runs as a Docker container, bundling all dependencies (Nginx, Certbot for Let’s Encrypt, the web UI) together. This makes installation, updates, and management very convenient.

Understanding Reverse Proxies (and why they’re not Forward Proxies)

It’s important to distinguish a reverse proxy from the traditional “forward” proxy many of us remember from the early internet days. A forward proxy sits between users on a network and the *external* internet, often used for caching or filtering outbound requests.

A reverse proxy does the opposite. It sits in front of your *internal* web servers and manages incoming requests from the *external* internet. When someone types zbx1.yourdomain.com, the request hits the reverse proxy first. The proxy then looks at the requested domain and forwards the traffic to the correct internal server (e.g., the machine hosting your Zabbix web GUI).

This is essential if you have only one public IP but want to host multiple websites or services using standard HTTPS (port 443).

The Crucial Role of DNS and Let’s Encrypt

DNS: Directing Traffic

How does a user’s browser know where to find your reverse proxy? Through DNS! You need to configure your public DNS records (usually on your domain registrar’s platform or DNS provider) so that the domain names you want to expose (e.g., zbx1.yourdomain.com, wiki.yourdomain.com) point to the public IP address of your Nginx Proxy Manager server. This is typically done using:

  • A Record: Points a domain directly to an IPv4 address.
  • CNAME Record: Points a domain to another domain name (often more flexible). For example, zbx1.yourdomain.com could be a CNAME pointing to proxy.yourdomain.com, which then has an A record pointing to your public IP.

Without correct DNS setup, requests will never reach your proxy.

Let’s Encrypt: Free and Automated SSL

Let’s Encrypt is a non-profit Certificate Authority that provides free, domain-validated SSL/TLS certificates. Before Let’s Encrypt, obtaining trusted certificates often involved significant cost and manual processes. Let’s Encrypt has democratized HTTPS, making it easy and free for everyone.

The main “catch” is that their certificates have a shorter validity period (e.g., 90 days). This is where Nginx Proxy Manager shines – it handles the initial domain validation (“challenge”) and the periodic, automatic renewal process, ensuring your sites remain secure without manual intervention.

Getting Started: Installation via Docker Compose

Installing Nginx Proxy Manager is straightforward using Docker Compose. Here’s a basic docker-compose.yml file similar to the one I use:


version: '3.8'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# Public HTTP Port for Let's Encrypt challenges
- '80:8080'
# Public HTTPS Port
- '443:443'
# Admin Web UI Port (access this in your browser)
- '81:81'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
# For production, consider using a proper database like MySQL/MariaDB instead of SQLite
# environment:
# DB_MYSQL_HOST: "db"
# DB_MYSQL_PORT: 3306
# DB_MYSQL_USER: "npm"
# DB_MYSQL_PASSWORD: "your_password"
# DB_MYSQL_NAME: "npm"
# depends_on:
# - db

# Uncomment this section if using MySQL/MariaDB
# db:
# image: 'jc21/mariadb-aria:latest'
# restart: unless-stopped
# environment:
# MYSQL_ROOT_PASSWORD: 'your_root_password'
# MYSQL_DATABASE: 'npm'
# MYSQL_USER: 'npm'
# MYSQL_PASSWORD: 'your_password'
# volumes:
# - ./data/mysql:/var/lib/mysql

Key Ports Explained:

  • 80:8080: Maps external port 80 to the container’s port 8080. Port 80 is needed externally for Let’s Encrypt HTTP-01 challenges.
  • 443:443: Maps external port 443 (standard HTTPS) to the container’s port 443. This is where your proxied traffic will arrive.
  • 81:81: Maps external port 81 to the container’s port 81. You’ll access the Nginx Proxy Manager admin interface via http://your_server_ip:81.

Volumes:

  • ./data:/data: Stores configuration data (using SQLite by default).
  • ./letsencrypt:/etc/letsencrypt: Stores your SSL certificates.

To start it, simply navigate to the directory containing your docker-compose.yml file and run:

docker-compose up -d

Note: For environments with many sites, the official documentation recommends using MySQL or MariaDB instead of the default SQLite for better performance.

Configuring a Proxy Host: A Quick Walkthrough

Once the container is running, access the web UI (http://your_server_ip:81). The default login credentials are usually admin@example.com / changeme (you’ll be prompted to change these immediately).

From the dashboard, you’ll see options like Proxy Hosts, Redirection Hosts, Streams (for TCP/UDP forwarding), and 404 Hosts.

To expose an internal service (like Zabbix):

  1. Go to Hosts -> Proxy Hosts.
  2. Click Add Proxy Host.
  3. Details Tab:

    • Domain Names: Enter the public domain name(s) you configured in DNS (e.g., zbx1.quadrata.it).
    • Scheme: Select the protocol your *internal* service uses (usually http for Zabbix web UI).
    • Forward Hostname / IP: Enter the internal IP address of your Zabbix server (e.g., 192.168.1.100).
    • Forward Port: Enter the internal port your service listens on (e.g., 80 for Zabbix web UI).
    • Enable options like Block Common Exploits and Websockets Support if needed.

  4. SSL Tab:

    • Select Request a new SSL Certificate from the dropdown.
    • Enable Force SSL (redirects HTTP to HTTPS).
    • Enable HTTP/2 Support.
    • Enter your email address (for Let’s Encrypt notifications).
    • Agree to the Let’s Encrypt Terms of Service.

  5. Click Save.

Nginx Proxy Manager will now attempt to obtain the certificate from Let’s Encrypt using the domain you provided. If successful, the entry will show as green/online. You should now be able to access your internal Zabbix interface securely via https://zbx1.quadrata.it!

There’s also an Advanced tab where you can add custom Nginx configuration snippets for more complex scenarios, which is incredibly useful.

Wrapping Up

Nginx Proxy Manager is a fantastic tool that bundles complex functionalities like reverse proxying and SSL certificate management into an easy-to-use package. It lowers the barrier to entry for securely exposing web services and makes ongoing management much simpler, especially with its automated certificate renewals and clear web interface.

Whether you’re managing home lab services, small business applications, or just experimenting, I highly recommend giving it a try. It saves time, enhances security, and simplifies your infrastructure.

What are your thoughts on Nginx Proxy Manager? Have you used it or similar tools? Let me know in the comments below!

If you found this helpful, consider subscribing to the Quadrata YouTube channel for more content on open-source solutions and IT topics.

And don’t forget, if you have Zabbix questions, join our growing community on the Zabbix Italia Telegram Channel!

Thanks for reading, and I hope to see you in the next video!

– Dimitri Bellini

Leave a comment

Your email address will not be published. Required fields are marked *