Comment on Listmonk email server, running via docker through nginx vhost. Resolves with port at the end but I get a 502 bad gateway error without the port.

bigredgiraffe@lemmy.world ⁨11⁩ ⁨months⁩ ago

the purpose of using nginx is to not have to use the port number in this scenario, the reason it works is because your DNS for that hostname still points to that machine that both containers are running on. Normal DNS A and cname records do not contain port information.

The 502 bad gateway error means that nginx is not able to connect to the upstream host for that hostname, this is where you need to use the port for the other container (5870). Do know that using localhost in docker will not have the results you are expecting, if these are on the same host you can use the name you have configured for the container as the hostname in nginx otherwise use the host IP, in your case it would be http://listmonk_app:5870.

Hope that helps!

source
Sort:hotnewtop