# The http port to use
http_port = 3951
# The public facing domain name used to access grafana from a browser
domain = localhost
# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
enforce_domain = true
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
You defined that Grafana is running on localhost:3951. But keep in mind that each container has own network namespace = own localhost, which is not related to localhost of other containers by default (unless you configure container to use host network).
But it looks like you are on windows, so probably your Docker host is only VM in your Windows Host OS. So that “host network” can be more complicated.
Generally, make sure that upstream:
upstream grafana {
server localhost:3951;
}
is reachable from the nginx container. If Grafana is also container, then I would use docker network.