it’s the same to me. Anyway, the 5 point guide as mentioned above is okay.
But (still) there are some drawbacks.
When you restart docker the containers may get different IPs. In portainer itself you could/should enter a distinctive static address for each container. Also keep in mind the networks of your apps!
The error 502 Bad Gateway occurs, because the redirect ip changed, and now cannot be reached.
You get rid of it when you give nginx proxy the right IP address.
The ad-hoc workaround would be, changing the proxy settings to the actual, new container IP.
Right now, the greatest disadvantage obviously of the YNH redirect app is, that you cannot edit settings afterwards over GUI.
To do this you can edit the setting files manually:
It’s just the workaround!
nano /etc/nginx/conf.d/SUB.DOMAIN.XY.d/redirect.conf
Change the IP to point to the right container:
proxy_pass http://172.19.0.4:9000;
Then restart the proxy
systemctl restart nginx
And then call the server again
SUB.DOMAIN.XY
It should run. But this kind of frickle-frackle is not, what we want.
On the other hand, as mentioned in the description of the YNH redirect app, we should use a local ip.
Test what you get using curl. For example
curl http://127.0.0.1:9000
curl http://127.0.0.1:81
curl http://172.19.0.4:81
…
Okay, so now, for portainer I edited
nano /etc/nginx/conf.d/portainer.example.org.d/redirect.conf
change proxy_pass and then restart nginx.
proxy_pass http://127.0.0.1:9000
With the installation of the YNH redirect app (see step 4 above) it would be the
Redirect destination path:
http://127.0.0.1:9000
Now call the server again over secured https
https://portainer.example.org
and you will get the login screen of portainer.