Nginx Proxy Manager
Setting up NGINX Proxy Manager (NPM) with Docker containers is a convenient way to manage access to services on a Linux machine.
With built in Let’s Encrypt support you can secure your web services at no cost to you. The certificates even renew themselves!
Using Docker Compose
All configuration is defined in a single Docker Compose file.
Firstly, create a working folder in you user directory. Create two extra folders inside called data
and letsencrypt
mkdir proxy
cd proxy
mkdir data letsencrypt
touch docker-compose.yml
Edit the initial docker-compose.yml
file pasting this example:
services:
app:
container_name: proxy
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
environment: #configure these or other options as required
- TZ=America/New_York
- ENABLE_IPV6=true
networks:
- proxy
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
networks:
proxy:
name: proxy
Launching
cd ~/proxy
docker compose up -d
This will launch the container and detach from it to run in the background (the -d
option)
Configuring NGINX Proxy Manager
Access the NGINX Proxy Manager web interface
After starting the container, you can access the NPM web interface by opening a web browser and navigating to its initial admin port.
http://localhost:81
If you're running the NPM container on a remote machine, replace localhost with the IP address or hostname of that machine.
NoteFor hosted virtual machine, make sure there is a network rule permitting access to this port.
Later we will use NPM to self-host it's admin port.
Set up NGINX Proxy Manager
Once you access the web interface, you'll be prompted to set up your admin account. Follow the on-screen instructions to create the account.
Manage services
After logging in with the admin account, you can use the NPM web interface to manage access to your services. You can add new proxy hosts, define SSL certificates (see TLS Setup), configure routing rules, and more. NPM will automatically generate the NGINX configuration for you.
That's it! You now have NGINX Proxy Manager running as a Docker container and can use it to manage access to services on your Linux machine. Remember to configure your services to use the NGINX Proxy Manager as a reverse proxy by pointing their domains or subdomains to the IP address of your Linux machine.
Note also that it is no longer necessary to configure certificates and expose ports for your services to the outside world. You can keep them private and only allow access through the NGINX Proxy Manager. In addition, you can use the NPM web interface to manage access to multiple services on the same machine.
tipYou can even use NPM to manage access to the NPM web interface itself. For example, you can set up a proxy host for the domain "npm.yourdomain.com" and then configure it to point to the NPM web interface. This way, you can access the NPM web interface through a secure connection without exposing it to the outside world.