Behind NGINX Dashboard fails

Accessing grafana behind nginx gives dashboard failures. Not sure why its failing. in the grafana.ini file I configured domain with localhost or the domain and it failures. When I access the site via port 3000 it works correctly.

image

NGINX config

location ~* /grafana/ {
        proxy_set_header Host $http_host;
        proxy_pass http://grafana;
  }

  # Proxy Grafana Live WebSocket connections.
  location ~* /grafana/api/live/ {
    rewrite  ^/grafana/(.*)  /$1 break;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $http_host;
    proxy_pass http://grafana;
  }

Grafana config

[server]
;protocol = http
;http_addr =
;http_port = 3000
domain = localhost
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true

I think you want to proxy-pass directly to the grafana server on 3000: proxy_pass http://localhost:3000/;