8 min read

Installing Nginx Proxy Manager: Efficient Reverse Proxy Management

Installing Nginx Proxy Manager: Efficient Reverse Proxy Management

In the previous article, we delved into the step-by-step process of creating a self-signed certificate for our Home Lab.

Create a Valid Self-Signed SSL Certificate
In the previous article, we delved into the step-by-step process of setting up Vaultwarden in our Home Lab. Installing Vaultwarden: Secure Password Manager for Your Home LabIn the previous article, we delved into the step-by-step process of setting up Tailscale VPN in our Home Lab. Installing Tailscale VPN: Access Your

In this article, we'll turn our spotlight to Nginx Proxy Manager - A powerful tool that simplifies the way we access our web services.

Why do we need a reverse proxy?

In web services, a reverse proxy acts as an intermediary server that handles client requests and forwards them to the appropriate backend servers. It not only adds a layer of security by hiding the details of the backend servers but also simplifies the management of multiple services running on different ports.

There are many advantages of using a reverse proxy. The reverse proxy can handle our SSL certs and we can easily manage them. It also ensures secure communication between clients and servers by encrypting the data during transit, adding an extra layer of protection. Certain reverse proxies can also perform load-balancing operations, caching, compression, and much more.

What is Nginx Proxy Manager?

As the name suggests, Nginx Proxy Manager uses the power of the Nginx web server to manage and simplify the proxying of web services. It provides a user-friendly web interface to configure Nginx as a reverse proxy, eliminating the need for manual configuration files and making the process accessible to users with varying levels of technical expertise.

Key Features of Nginx Proxy Manager include:

  1. User-Friendly Interface
  2. SSL Certificate Management
  3. Wildcard and Subdomain Support
  4. Easy SSL Certificate Generation & renewal using Let's Encrypt ( for valid domains)

Steps to install Nginx Proxy Manager:

  • We'll be using Portainer Stack again to install Nginx Proxy Manager in our Home Lab. First, let us log in to our Portainer instance and then head to our local docker instance by clicking on the local option.
  • Here we can use the Stack option to deploy our Nginx Proxy Manager instance using our docker-compose file. Let's click on the Stacks option.
  • We can click on the Add Stack button on the top right to create a new stack.
  • We can give the name of the stack and then just copy and paste the below docker-compose file of our Nginx Proxy Manager instance.
version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: always
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - npm_data:/data
      - npm_letsencrypt_data:/etc/letsencrypt

volumes:
  npm_data:
  npm_letsencrypt_data:
  • Once done we can click on the Deploy the Stack button to deploy our Nginx Proxy Manager instance.
  • We can see that the stack has been successfully created. On viewing it, we can see that our Nginx Proxy Manager has been successfully installed and the container has started running.

We have successfully installed the Nginx Proxy Manager instance on our Home Lab. We now need to configure our Nginx Proxy Manager to start using it.

Configuring Nginx Proxy Manager:

  • First, we need to head to the Nginx Proxy Manager's admin console. By default the admin console would reside in port 81 for Nginx Proxy Manager. We can type in the IP Address:81 to open the same.
  • We'll be greeted with the above login screen. We can log in to the same using the below default email address and password.
💡
Email: [email protected]
Password: changeme
  • Now it will ask us to change the default login information. We can give in our Full Name, Nickname, and Email address for the admin account and then hit the save button
  • We can now type in the current default password and then the new password for our admin account. Upon typing, we can hit the save button to save the details of our admin account.
  • Before proceeding further let us upload our self-signed SSL certificate that we created in the previous article so that we can access all our services via HTTPS.
  • We can also use Let's Encrypt to automatically generate our SSL certs and renew them if we have a valid domain. Let's look at this in detail in another article. But for now, let's proceed with our self-signed certificate.
  • We can click on the SSL Certifications option on the header to get started with the same.
  • Now we can click on the Add SSL Certificate option in the header (not the one at the center of the screen) and click on the Custom option so that we'll be able to upload our cert.
  • Now on this screen, we can give the name for our Certificate. I'll just give it as "HomeLab". Now for the Certificate key, we can select the CertKey.pem file which we generated previously. Also, we can select Cert.pem file for the Certificate option.
  • We can hit the save button to store the SSL Certificate.
  • Upon hitting the save button it would load for a bit and then the certificate would appear along with the expiration date. We will now be able to use this certificate to access our web services using a domain name instead of IP:Port number.
  • We can now head over to the Hosts -> Proxy hosts option to add our first proxy which would be our current Nginx Proxy Manager instance.
  • We can click on the Add Proxy Host button to add our very first proxy host.
  • We can give the domain name using which we can access our Nginx Proxy Manager instance. I'll give it as "npm.home.lab" as I have used "home.lab" as my DNS name during the creation of my self-signed certificate. This can vary depending on the name that you gave during your certificate creation.
  • We can also Nginx Proxy Manager without this SSL Certificate. It is optional and not mandatory as all our services are in our local network. You can give any domain name to access the service if you're not going to use any SSL Certs.
  • Now to add our SSL cert we can head to the SSL tab.
  • Here, we can see the SSL Cert that we uploaded. We can select that certificate.
  • Now, we can enable to Force SSL option so that the website would automatically use HTTPS even if we try to access the site using HTTP.
  • This whole SSL setup will not be applicable if you're not going to use SSL. You can skip this SSL configuration if the SSL cert is not being used.
  • We can hit the save button to save the proxy host.
  • We can now see that our proxy host has been added successfully.
  • Now we need to make one final configuration to access our Nginx Proxy Manager instance using this "npm.home.lab" domain name. We need to configure this Nginx Proxy Manager instance as our DNS server so that Nginx Proxy Manager will have the control to resolve all our added proxy hosts.
  • We can directly configure this in our router by going to the router page and then typing in the IP address of our Nginx Proxy Manager instance directly in the DNS server field. However, this is applicable for people without any adblocker like AdGuard installed. If you have an ad blocker like AdGuard Home installed then we need to configure it in that web service.
  • The above is a screenshot of my router page. Here, I can type in the IP address of my Nginx Proxy Manager as the Primary DNS and hit the save button to save the details. Again this works for people without any AdBlocker. But we have already installed AdGuard in our HomeLab. In this case, we can configure this in our AdGuard Home instance.
  • We can now open our AdGuard Home instance by typing in the IP:3000 to open the admin console.
  • We can now head to the Filters -> DNS Rewrites option.
  • Now we can click on the Add DNS rewrite button to add our rewrite configuration in AdGuard Home.
  • Here we can type in the DNS name for which we need to rewrite and point it to our Nginx Proxy Manager instance. Since I have used "home.lab" & "*.home.lab", I'll point both of these to the IP of my Nginx Proxy Manager Instance. We can hit the save button to save the configuration details.
  • Now we have successfully configured our Nginx Proxy Manager and pointed our DNS name to our Nginx Proxy Manager inside our AdGuard Home instance as well.
  • We will now be able to access our Nginx Proxy Manager instance using "npm.home.lab" domain name which we configured.

We have now successfully installed and configured our Nginx Proxy Manager instance. Using this method we can add proxy hosts to all our web services and access them using domain name.

In this article, we have explored Nginx Proxy Manager and went into the step-by-step process of deploying the same in our Home Lab.

In the next article, we will be looking into another service that we will be deploying in our Home Lab. Stay tuned for more detailed instructions on expanding our Home Labbing capabilities.

Happy Homelabbing!!!