A quick introduction to NGINX Proxy Manager
3 min read

A quick introduction to NGINX Proxy Manager

A quick introduction to NGINX Proxy Manager

Have you ever wanted to host multiple webservers on the same IP address? NGINX Proxy Manager solves that problem. It serves as a webserver, and redirects every URL that points to your server, to the URL you configured. In example, this blog is running behind NGINX Proxy Manager.

WARNING: Opening ports on your network could be dangerous. Please make sure that you know what you're doing!

So, lets jump into it!

What do you need?
-
A domain, pointing to your IP address, learn more about DNS here.
- Some PC/Server/Raspberry Pi running Docker-Compose, learn more about it here.

Deploying NGINX Proxy Manager:

If you use Portainer, you can easily create a new stack, add this and your container is up and running!

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - /data/docker/npm/data:/data
      - /data/docker/npm/letsencrypt:/etc/letsencrypt

If you just use plain Docker Compose:

  1. Make a new directory.
  2. Make a new file named docker-compose.yml.
  3. Paste this into the file:
version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - /data/docker/npm/data:/data
      - /data/docker/npm/letsencrypt:/etc/letsencrypt

After this, you need to port forward port 80 and 443 of your server to the internet. Learn more about port-forwarding here.

For the next step you'll need a CloudFlare account with a domain set up. Point the domain to the IP address of your NGINX Proxy Manager instance, for example this screenshot:

If you create a CNAME, as shown here, you can point all your other subdomains to that CNAME using the CNAME type. This is so that you only have to change one domain if you get a new IP address.

Then go into your NGINX Proxy Manager at <server-ip>:81. In my case this is 192.168.2.1:81. Log in with the default credentials: [email protected]:changeme. After you've logged in and changed your password, you can create your first proxy host. For example NGINX Proxy Manager to npm.yourdomain.ext.

As you can see I've made the IP 172.17.0.1. This is my Docker IP address, which makes everything a tiny bit more secure.

NGINX Proxy Manager also has SSL using Let's Encrypt. To enable it, create a new host, or edit one. Go to the SSL tab and select an SSL certificate (we have to create one first, so select 'Request a new SSL certificate'). Use the following settings to be extra secure:

Congratulations! You've now made a secured reverse proxy host using NGINX Proxy Manager.

You can create as many proxy hosts as you want. If you have errors whilst using the reverse proxies, please try your SSL certificate settings, also on CloudFlare (or any other DNS). If it still doesn't seem to work, send me an email: [email protected]