I’m trying to serve Grav from the Linuxserver Grav container (port 80 mapped to 8080) from nginx running in a SWAG container, but I get a 502 Bad Gateway error.
Both containers are running on a VPS with domain vps.domain.com.
I can access the Grav instance if I access the container’s port directly, i.e. vps.domain.com:8080.
I can ping the Grav container from the SWAG container (“ping grav”), but I get “connection refused” if I try to curl the Grav container on the exposed port (curl grav:8080).
I can successfully curl the SWAG container from the Grav container (curl swag:80).
And here is the location block of the relevant proxy config file:
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app grav;
set $upstream_port 8080;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
Ah I completely misunderstood the meaning of that bullet point
I did more reading and now understand that it’s the internal container port that needs to be defined as $upstream_port since it’s connecting to the container directly.