Installation Guide for Nginx Proxy Manager in Docker Environment: Building a Visual Nginx Reverse Proxy Server

Publish: 2023-06-30 | Modify: 2023-06-30

To facilitate public access to domain names and support HTTPS in an intranet environment with multiple different web services, a common practice is to set up an Nginx service as a reverse proxy in the intranet, which centralizes services, enables domain name access, and deploys SSL certificates.

However, manually configuring Nginx can be troublesome, error-prone, and not very beginner-friendly. But with Nginx Proxy Manager, this problem can be easily solved.

About Nginx Proxy Manager

Nginx Proxy Manager is a lightweight, high-performance web proxy (including reverse proxy) and email proxy based on Docker. It has a user-friendly interface that makes it easy to create and manage Nginx proxy hosts.

Its features include:

  • Easy-to-use interface: For users who are not familiar with Nginx configuration files, Nginx Proxy Manager provides an intuitive interface for easily creating and managing Nginx proxy hosts.
  • SSL support: Nginx Proxy Manager supports Let's Encrypt, which automatically obtains and renews SSL certificates to ensure communication security.
  • Websockets support: Nginx Proxy Manager fully supports Websockets, which are required by many modern web applications.
  • Access control: Access can be controlled, for example, by setting basic HTTP authentication or restricting access based on IP addresses.
  • HTTP/2 support: Nginx Proxy Manager supports HTTP/2, which provides higher transmission efficiency.
  • Custom Nginx configuration: Although Nginx Proxy Manager provides default configurations for most purposes, custom Nginx configurations can be provided if needed.
  • Docker support: Nginx Proxy Manager is based on Docker, which means it can be run on any platform that supports Docker.
  • 100% free and open source: Nginx Proxy Manager is open source and can be used and modified freely.

In summary, Nginx Proxy Manager is a powerful tool that makes managing Nginx reverse proxies easier, especially for users who are not familiar with Nginx configuration files.

Installing Nginx Proxy Manager with Docker-Compose

First, make sure you have Docker-Compose installed, then create a directory to save Nginx Proxy Manager data:

# Create a directory
mkdir nginx
# Enter the directory
cd nginx

In the newly created directory, create a file named docker-compose.yaml and copy the following content into it:

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '880:80'
      - '81:81'
      - '8443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
  • 880 is the HTTP port of Nginx, you can modify it according to your own situation.
  • 8443 is the HTTPS port of Nginx, you can modify it according to your own situation.
  • 81 is the port for the Nginx Proxy Manager management interface.

Then use the command docker-compose up -d to start Nginx Proxy Manager. After it starts successfully, enter http://IP:81 to open the Nginx Proxy Manager visual (web) interface.

The first time you use it, you will be prompted to modify the email, password, and other information. Please follow the prompts to complete the modification.

Adding Reverse Proxies

Open the navigation bar and go to "Hosts - Proxy Hosts - Add Proxy Host", enter your domain name and the target protocol + target IP + target port for reverse proxy, and then click SAVE to save.

Then, resolve your domain name to the IP address where Nginx Proxy Manager is located, so that you can access it through http://your-domain:880 (Note: I used port 880 for HTTP above).

Deploying SSL Certificates

Nginx Proxy Manager comes with a default "Let's Encrypt" SSL certificate, but it may not work in China due to the Great Firewall. However, Nginx Proxy Manager also supports adding custom SSL certificates.

Open the navigation bar and go to "SSL Certificates - Add SSL Certificate - Custom".

Follow the instructions to fill in the SSL certificate name and select the private key file and certificate file, then click SAVE to save.

Go back to "Proxy Hosts", find the domain name you added earlier, and then modify it. Switch to the "SSL" tab, select the custom SSL certificate you just added, and click save.

After deployment, access it again with the HTTPS protocol, and if you are using a non-standard port (not 443), you need to include the port in the URL, for example: https://your-domain:8443.

Upgrading Nginx Proxy Manager

Since it is deployed using Docker-Compose, upgrading Nginx Proxy Manager to a new version is also very simple. Just execute the following command:

# Pull the new image
docker-compose pull
# Restart Nginx Proxy Manager
docker-compose up -d

Other Features

In addition to the basic features mentioned above, Nginx Proxy Manager also supports some other features, such as:

  • Custom reverse proxy configurations to meet complex reverse proxy requirements
  • Support for basic password authentication
  • Support for IP access restrictions
  • Support for stream port forwarding

These can all be done directly through the web interface, which is very convenient. If you are interested, you can explore them on your own.

Conclusion

Nginx Proxy Manager is highly suitable for NAS users. With Nginx Proxy Manager, configuring Nginx reverse proxies becomes easier, and both beginners and experienced users can benefit from the web interface, which improves efficiency.

Nginx Proxy Manager official website: https://nginxproxymanager.com/


Comments