try.directtry.direct

Back to explains list

Nginx Proxy Manager

What is Nginx Proxy Manager

Nginx Proxy Manager is a user-friendly software application designed to effortlessly route traffic to your websites, whether they're hosted at home or elsewhere. It comes equipped with free SSL capabilities, eliminating the need for extensive Nginx or Letsencrypt knowledge. This tool proves especially handy for simplifying SSL generation and seamlessly proxying your docker containers.


How to use Nginx Proxy Manager


Nginx Proxy Manager stands as an optional but highly recommended companion application. Its inclusion is particularly beneficial when managing multiple web applications in the backend. We also recommend to include Portainer CE.

Once the deployment is complete, you need to configure the proxy host in the Nginx Proxy manager.

At First, you need to associate your domain name with the public IP of your new server!

  1. Open http://<your_server_public_ip>:81 in your browser and enter the following credentials:
  • Login: admin@example.com
  • Password: changeme

image: Nginx Proxy Manager - Login to your account

2. Next, log in to Portainer to identify the hostname to be used for proxying traffic. (You should receive the link to Portainer and the credentials in the email attached within the PDF file.)


image: Portainer - Login page

3. Upon accessing Portainer, navigate to the "Environments" section and select "local."


image: Portainer - Environments

4. Proceed to "Stacks."


image: Portainer - Dashboard | TryDirect

Here, you will find a list of all applications deployed with Docker. In our case, our target is the "simple-flask" application, so click on it.

Note the required hostname, in our case, it's "flask-app," and observe that it operates on port 5000. Your specific application might use a different hostname and port configuration, depending on your chosen exposed application.


image: Portainer - Stack LIst | TryDirect

5. The next step involves routing traffic to the chosen application through the Nginx Proxy Manager. While logged into Nginx PM, navigate to "Proxy Hosts."


image: Nginx Proxy Manager - Proxy hosts configuration

image: There are no Proxy Hosts

6. Click on the "Add Proxy Host" button and provide the necessary details:

  • Domain Name (the domain name you acquired from your domain registrar)
  • Redirect Host Name/IP (the hostname of the target application you want to connect)
  • Redirect Port (for our case, it's 5000; however, if you use Nginx as a web server, it's likely port 80)

image: New Proxy Hosts

7. Click the "Save" button

If everything is correctly configured, your proxy host's status should display as "ok."


image: NPM - Proxy Hosts

8. Proceed to visit your website using the designated domain name.


image: Hello, World! Flask | TryDirect

9. Should you wish to implement SSL (for availability via the HTTPS protocol), modify your proxy host settings and add SSL to it.


image: Edit Proxy Host | Nginx Proxy Manager

image: Edit Proxy Host - Force SSL

10. Please be cautious: You need to associate your domain name with the public IP of your site first. This can be accomplished on your domain registrar's website by modifying the "A" record value to match your new server's IP address.


Next article: Status Panel