Grafana 设置二级目录及配置 Nginx 代理

步骤

设置环境变量:

1
2
3
4
5
  env:
- name: GF_SERVER_ROOT_URL
value: "%(protocol)s://%(domain)s:%(http_port)s/grafana"
- name: GF_SERVER_SERVE_FROM_SUB_PATH
value: "true"

此时 NGINX 进行反向代理的配置:

1
2
3
4
5
6
location /grafana/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://10.55.3.160:31120/;
}