Grafana v8.3.3二进制部署打开异常问题记录

背景

grafana 是通过docker方式部署的,浏览器打开异常

浏览器

Google Chrome	101.0.4951.54 (正式版本) (64 位) (cohort: Stable) 

排查思路

http://ip:port直接访问是否正常? 正常的

nginx 路径转发是否有问题?无法打开

报错日志

If you're seeing this Grafana has failed to load its application files


1. This could be caused by your reverse proxy settings.

2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath. If not using a reverse proxy make sure to set serve_from_sub_path to true.

3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build

4. Sometimes restarting grafana-server can help

5. Check if you are using a non-supported browser. For more information, refer to the list of supported browsers.

查看官网介绍只需要对于这种nginx反向代理需要加上子路径

root_url
This is the full URL used to access Grafana from a web browser. This is important if you use Google or GitHub OAuth authentication (for the callback URL to be correct).

Note: This setting is also important if you have a reverse proxy in front of Grafana that exposes it through a subpath. In that case add the subpath to the end of this URL setting.

nginx 转发地址

   # grafana private
    location ^~ /zcm-grafana/ {
        rewrite ^/zcm-grafana/(.*) /$1 break;
        #proxy_set_header 'Authorization' 'Bearer eyJrIjoiMTVCSUtDRFpEVDFpczV6RmVNODMyNVFaNmticHgwVHYiLCJuIjoibXl0ZXN0IiwiaWQiOjF9';
        proxy_pass http://172.16.17.82:3000/;
    }

解决方式

修改grafana.ini配置
linux默认路径/etc/grafana/grafana.ini

# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
;root_url = %(protocol)s://%(domain)s:%(http_port)s/

#修改后(去除首位分号)
# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
root_url = %(protocol)s://%(domain)s:%(http_port)s/zcm-grafana/

重启服务可以正常访问,问题解决。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

独步秋风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值