基於grafana反向代理配置

2020-05-03     波波說運維

概述

今天主要介紹一下如何將grafana地址配到abc.com域名的/grafana/的location下,也就是用戶訪問訪問http://abc.com/grafana正常跳轉到內網的grafana地址,類似MQ配置。

這裡簡單做個記錄。


一、nginx配置

相關配置如下:

nginx配置沒啥好講的,主要是grafana配置需要注意下...


二、grafana配置

在grafana配置文件(/etc/grafana/grafana.ini)中修改,配置後重啟grafana

#################################### Server ####################################
[server]
# Protocol (http, https, h2, socket)
protocol = http

# The ip address to bind to, empty will bind to all interfaces
;http_addr =

# The http port to use
#默認3000,所以上面nginx也代理3000埠,這部分也可以改成任意埠號
http_port = 3000

# The public facing domain name used to access grafana from a browser
#配置外部訪問域名
domain = app.xxx.com

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
enforce_domain = false

# 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 = https://app.xxx.com/grafana

內網主要是配置domain和root_url了。


三、驗證

1、外網訪問https://app.XX/grafana

2、內網訪問http://IP:3000



覺得有用的朋友多幫忙轉發哦!後面會分享更多devops和DBA方面的內容,感興趣的朋友可以關注下~


文章來源: https://twgreatdaily.com/j9Nx23EBnkjnB-0zw648.html