参考:
1. 修改grafana允许匿名查看
cat /usr/share/grafana/conf/default.ini
[auth.anonymous]
# enable anonymous access
enabled = true #默认false
# specify role for unauthenticated users
org_role = Viewer #默认Viewer,可用Admin
2. 添加nginx反向代理
cat nginx.conf
#反向代理grafana
location /grafana {
root html;
index index.html index.htm;
add_header 'Access-Control-Allow-Origin' '*';
add_header Access-Control-Allow-Methods GET,POST,OPTIONS,DELETE;
add_header 'Access-Control-Allow-Headers' 'userId,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
proxy_pass http://192.168.0.250:3000;
rewrite ^/grafana/(.*) /$1 break;
proxy_set_header Host $host;
}
3. 仅仅在nginx中配置还不够,还需修改grafana
cat /usr/share/grafana/conf/default.ini
domain = www.youdomain.com
root_url=%(protocol)s://%(domain)s:%(http_port)s/grafana
网友评论