在反向代理后面运行Grafana (sub-path)
在配合 CentOS 7环境Prometheus快速起步 ,也采用了相似的 sub-path
反向代理:
在 安装Grafana 完成后,对于反向代理,需要修订
/etc/grafana/grafana.ini
配置文件:访问域名
domain
访问url
root_url
配置修订位于 [server]
部分如下:
修订
/etc/grafana/grafana.ini
配置访问域名以及访问路径[server]
domain = onesre.cloud-atlas.io
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
在NGINX服务器上 配置
/etc/nginx/conf.d/onesre-core.conf
设置反向代理:
nginx反向代理,grafana用sub-path模式
/etc/nginx/conf.d/onesre-core.conf
upstream grafana {
server 192.168.8.151:3000;
}
server {
listen 80;
server_name onesre onesre.cloud-atlas.io;
location / {
include proxy_params;
# 有些发行版没有提供 proxy_params 配置,则使用如下配置
# proxy_set_header Host $http_host;
proxy_pass http://grafana;
}
}
启动服务(和Debian/Ubuntu相同):
启动Grafana
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server.service