Nginx Proxy Manager Docker Setup: Step-by-Step Guide
Nginx Proxy Manager Docker Setup: Step-by-Step Guide

Nginx Proxy Manager is a powerful tool that simplifies reverse proxy management with a user-friendly interface. In this guide, you will learn two effective methods to install Nginx Proxy Manager using Docker and Docker Compose. Both methods are optimized for performance, security, and scalability.

Prerequisites

Before starting, ensure you have Docker and Docker Compose installed. You can follow the official installation guides:

Method 1: Isolated Containers (Recommended for Most Users)

This approach uses separate containers for Nginx Proxy Manager and its database (usually MariaDB). It offers better isolation, increased security, and easier maintenance.

Step 1: Create a docker-compose.yml file

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'    # Public HTTP Port
      - '443:443'  # Public HTTPS Port (requires SSL)
      - '81:81'    # Admin Web Port
    volumes:
      - /path/to/your/data:/data                  # Persistent data storage
      - /path/to/your/letsencrypt:/etc/letsencrypt # Optional: SSL certificates

Note: Replace /path/to/your/data with your desired data storage path. The LetsEncrypt volume is optional but useful for SSL certificate management.

Step 2: Run the Containers

Navigate to your project directory and execute the following command:

docker-compose up -d

The -d flag runs containers in detached mode so they operate in the background.

Method 2: Host Network (For Advanced Users)

This method connects the Nginx Proxy Manager directly to your host’s network. It simplifies configuration but requires caution due to network sharing.

Step 1: Create a docker-compose.yml file

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    network_mode: "host"
    ports:
      - '80:80'       # Public HTTP Port
      - '443:443'     # Public HTTPS Port (requires SSL)
      - '127.0.0.1:81:81' # Admin interface accessible only locally
    volumes:
      - /path/to/your/data:/data
      - /path/to/your/letsencrypt:/etc/letsencrypt

Important: The network_mode: “host” connects the container to the host network directly. This exposes the container ports to your system network.

Step 2: Run the Container

Execute the command below in your terminal:

docker-compose up -d

Accessing Nginx Proxy Manager

After deployment, access the interface as follows:

  • Isolated Containers: http://<your_server_ip>:81
  • Host Network: http://localhost:81

Login credentials (default):

  • Username: admin@example.com
  • Password: changeme

⚠️ Important: Change credentials after the first login for security.

Conclusion

By following these methods, you can deploy Nginx Proxy Manager efficiently and securely. For most users, the isolated container method offers better security and easier maintenance. Advanced users who require direct access may prefer the host network method.

Both approaches ensure a flexible and manageable reverse proxy environment for your projects.

Leave a Reply

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