How to Setting Up Nginx Proxy Manager with Docker Compose in Portainer

Follow this detailed guide to install and set up the Nginx Proxy Manager using Docker Compose on an Ubuntu system via Portainer.

Why Do We Need This Proxy Manager?

In a network or on servers, many different applications often run on various ports. A proxy manager like the Nginx Proxy Manager offers several benefits:
  • Port Management: Hide the various ports behind a single domain.
  • Domain Management: Assign specific domains to different applications.
  • SSL Certificates: Easily create free SSL certificates or integrate your own certificates with minimal effort.

Example

Our desired domain desired-domain.com can be mapped to the IP 192.168.179.200:8181. This way, we can distribute the desired domain throughout the company or to customers, and they can easily access the application.

Preparing the Environment

  • Create necessary directories on the host:
  • These directories will be used for data, Let's Encrypt certificates, and the MySQL database.
  • Note: These directories should be created directly on the host system, not within the Docker container.
 
Bash

Docker Compose Configuration

  • Add the following configuration in Portainer as a new stack:
  • Open Portainer, navigate to "Stacks," and create a new stack. Copy and paste the following code:
 
YAML

  • Explanations:
  • Ports:
  • 80:80 - Public HTTP Port
  • 443:443 - Public HTTPS Port
  • 81:81 - Admin Web Port
  • Environment Variables:
  • Database connection parameters for MySQL/MariaDB
  • Volumes:
  • /opt/nginx_data/data - Stores Nginx Proxy Manager data
  • /opt/nginx_data/letsencrypt - Stores Let's Encrypt certificates
  • /opt/nginx_data/mysql - Stores MySQL database
  • Important: Ensure that the directories are correctly adjusted. The ports should not be changed, as port 80 is very important.

Starting the Stack

  • After adding the stack in Portainer, the Nginx Proxy Manager will start.
  • Access: You can reach the admin area via http://your-ip:81 and configure your settings there.
  • Ports: Ports 80 and 443 are used for internal purposes, but port 81 opens the login page of the Proxy Manager, where you can manage your domains and IPs.

Access Credentials

  • Default Access Credentials:
  • Email: admin@example.com
  • Password: changeme
  • Important: Change the email and password to your desired credentials after the initial setup.

Summary

  • Create the necessary directories: Run the specified commands on your host system.
  • Configure Docker Compose: Copy and paste the docker-compose.yml configuration into Portainer.
  • Start the Stack: Save and start the stack in Portainer.
  • Change Access Credentials: Log in with the default credentials and change them immediately.
Calls to Action:
  • Create Directories: Run the specified commands on your host system.
  • Configure Docker Compose: Copy and paste the docker-compose.yml configuration into Portainer.
  • Start the Stack: Save and start the stack in Portainer.
  • Change Access Credentials: Log in with the default credentials and change them immediately.

 {fullWidth}

0 $type={blogger}:

Kommentar veröffentlichen