Reverse Proxy with Nginx Proxy Manager on Docker

If you are getting serious about running services from home you will need reverse proxy manager so you can access you services with domains/subdomains instead of IP:PORTNUMBER.

When I first started I went threw many guides and tutorials on how to setup a Reverse Proxy with having SSL certificates issues automatically and the easiest to setup and use in my opinion is Nginx Proxy Manager.

Domain Name & Router Configuration

Before we take any further steps now we will need to work on getting our domain/subdomain pointing to our IP and also open any necessary ports on our firewall/router..

In my case I will be deploying Nginx Proxy Manager on my home network so my first step will be to find out my IP address so I can create some A records on my domain so they can point to my IP address.

If you don’t know you IP Address you can visit IP Chicken.

Then once you have the IP you will need to create an A Record for your domain/subdomain pointing to your IP.

For example if your domain is example.com you can create the subdomain nginx.example.com with A Record with your IP address.

Once you have that now in my case its time to open ports 80 (http) & 443 (https) and forward them to your Docker’s IP address and to ports 8080 (for http) and 4443 (for https).

HTTP
Port: 80 -> Port: 8080
HTTPS
Port: 443 -> Port: 4443

I am using pfSense as my firewall/router so thats where I had to open the above ports. So in your case the above ports will have to be open up on your router.

Once you have the above ports open and forwarding to your Docker box now we are ready to deploy Nginx.

Deploying Nginx Proxy Manager

The deployment of Nginx Proxy Manager is pretty easy you will just need to execute the following code:

docker run -d \
    --name=nginx-proxy-manager \
    -p 8181:8181 \
    -p 8080:8080 \
    -p 4443:4443 \
    -v /mydata/nginx-proxy-manager:/config:rw \
    jlesage/nginx-proxy-manager

The /mydata/nginx-proxy-manger/ will be the location where Nginx Proxy Manager will be storing all the necessary config files, logs etc.

As you can see in the above configuration, our container will be using ports 8181 (that’s where you can access the GUI) 8080 (for serving all the http requests) and 4443 (for serving all the https requests).

If your Nginx Proxy Manager container is up and running correctly then now its time to access it.

Accessing Nginx Proxy Manager

Point your browser to http://IPAdrress:8181

You can login with [email protected] and password changeme

Once you login you will be promtped to changed you credentials

Creating our first host with SSL

Start by clicking Hosts -> Proxy Hosts and then Add Proxy Host

So lets start by configuring nginx.example.com pointing of course to our Nginx Proxy Manager which lets say for example is currently on http://192.168.0.10:8181

Also in order to enable to automaticly have SSL via Let’s Encrypt

Once you press Save and if everything has been setup correctly thus far then you should be able to access your Nginx Proxy Manager from https://nginx.example.com

Now you can start creating more subdomains following the same steps as we did earlier.

Create an A Record pointing to your IP Address and then configuring the subdomain on your Nginx Proxy Manager instance.