Running Grafana with sub path behind NGINX

grafana.ini

[server]
domain = example.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true

nginx.conf

server {
  listen 80;
  root /usr/share/nginx/html;
  index index.html index.htm;

  location /grafana {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://grafana:3000;
  }
}

Note: DO NOT add the trailing slash “/” at the end of the “proxy_pass”.

發佈留言

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料