DEV Community

Marco
Marco

Posted on • Originally published at blog.disane.dev

Nginx Proxy Manager: Lightweight reverse proxy 🌍

Learn how to install Nginx Proxy Manager with Docker and set it up as a reverse proxy for HTTP, HTTPS and UDP! 🌍


The Nginx Proxy Manager (NPM) is a powerful and user-friendly tool for managing reverse proxy configurations. It simplifies the process of setting up a reverse proxy and allows you to manage multiple applications from a single interface. In this article, you will learn how to install Nginx Proxy Manager with Docker, how it works as a reverse proxy and what advantages it offers over a traditional network configuration.

Why use Nginx Proxy Manager? 🤔

Nginx Proxy Manager makes it easy to manage web servers and SSL certificates and provides an intuitive web interface for configuring Nginx reverse proxies. Here are some of its outstanding features:

  • HTTP and HTTPS support: Easily configure HTTP and HTTPS sites.
  • Let's Encrypt integration: Automatically manage SSL certificates.
  • UDP redirects: Support for UDP redirects in addition to traditional TCP redirects.

Installing Nginx Proxy Manager with Docker 🐳

Installing Nginx Proxy Manager with Docker is quick and easy. Here is a step-by-step guide on how to set up Nginx Proxy Manager on your server:

Preparation

Make sure that Docker is installed on your system. If not, you can install Docker using the official Docker installation instructions.

Create Docker-Compose file

Create a docker-compose.yml file with the following content:

version: '3'
services:
  npm:
    image: jc21/nginx-proxy-manager:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "81:81"
      - "443:443"
    environment:
      DB_SQLITE_FILE: "/data/database.sqlite"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

Enter fullscreen mode Exit fullscreen mode

Start container

Execute the following commands to start the container:

mkdir -p data letsencrypt
docker-compose up -d

Enter fullscreen mode Exit fullscreen mode

That's it! Nginx Proxy Manager is now running on your server and can be reached via the IP address of your server on port 81.

How does a reverse proxy work? 🛠️

A reverse proxy is a server that receives requests from clients and forwards them to one or more backend servers. It acts as an intermediary between the clients and the servers that provide the actual content. Here is a simple diagram showing how a reverse proxy works:

Comparison with a network without reverse proxy

Without reverse proxy:

  • Each application must run on a separate port or subdomain.
  • Managing SSL certificates for each application is complex and time-consuming.
  • Scalability and load balancing are more difficult to manage.

With reverse proxy:

  • All requests are managed from a central point.
  • SSL certificates can be centrally managed and automatically renewed.
  • Easier scaling and load balancing of backend servers.

Integration into your network 🌐

To integrate the Nginx Proxy Manager into your network, you need to configure the DNS settings and the forwarding rules.

DNS configuration

Configure the DNS entries of your domain so that they point to the IP address of the server on which the Nginx Proxy Manager is running. This can be done via your domain registrar or your internal DNS server. This can also be, for example, your AdGuard Home from this article

https://blog.disane.dev/adguard-home-ad-blocker-fur-alle-gerate-im-netzwerk

Set up forwarding rules

Log in to the Nginx Proxy Manager web interface and set up forwarding rules for your applications. You can configure HTTP and HTTPS redirects as well as UDP redirects.

HTTPS support with Let's Encrypt 🔒

The Nginx Proxy Manager supports the automatic management of SSL certificates via Let's Encrypt. You can easily set up and manage SSL certificates via the web interface.

Advantages of a reverse proxy

  • Security improvement: Through the centralized management of SSL certificates and the ability to release only necessary ports.
  • Easier management: All applications can be managed from a single interface.
  • Performance improvement: Backend servers can be used more efficiently thanks to caching and load balancing.

Conclusion 🎉

The Nginx Proxy Manager is a powerful and user-friendly tool for managing reverse proxies. With features such as HTTPS support, Let's Encrypt integration and UDP forwarding, it offers a comprehensive solution for managing web applications.

References to other articles 📚

Interested in how to secure internal services with SSL? Check out this article 👇🏼

Preview image


If you like my posts, it would be nice if you follow my Blog for more tech stuff.

Top comments (0)