docker – How to configure portainer and reverse nginx on my VPS?

I want to install NextCloud, CryptPad and other services on my VPS, which runs Ubuntu.

I want to do this using Portainer and Nginx Proxy Manager (NPM).

First, on my domain name provider cPanel, I have set the following redirections :

I don’t know if I should set the redirection to HTTP or HTTPS addresses… That’s my first question: what is the proper way to set up the redirection?

To install Portainer and Nginx Proxy Manager, I have followed this tutorial : dev.to/imzihad21/setting-up-a-vps-server-with-docker-nginx-proxy-manager-and-portainer-3hfk

I have successfully installed NPM, and I can access it using http://:81.

I have set up two proxy hosts :

Both SSL certificates have been properly created and deployed.

Here is what the configuration looks like :

Proxy hosts configuration

Portainer

When I go to portainer.my-domain.com/ (HTTPS), I have a “502 Bad Gateway” error message. The address displayed in Firefox’s adress bar does not change (portainer.my-domain.com/).

With the HTTP address (portainer.my-domain.com/), I get redirected to the HTTPS adress and get the same 502 error.

NPM

The behaviour is different with NPM (probably due to the different redirection to HTTPS?).

When I go to npm.my-domain.com/ (HTTPS) I get redirected to https:// (HTTPS) and get a SSL_ERROR_UNRECOGNIZED_NAME_ALERT error message.

When I go to npm.my-domain.com/ (no S) I get redirected to https:// (HTTPS)

How can I solve this problem?

Read more here: Source link