grafana从http切换到https

问题描述:

我已成功在我的服务器上运行grafana实例。它在http上运行,没有问题。现在我想从http切换到https。我grafana.ini是波纹管显示:grafana从http切换到https

#################################### Server #################################### 
[server] 
# Protocol (http or https) 
protocol = https 

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

# The http port to use 
http_port = 3000 

# The public facing domain name used to access grafana from a browser 
;domain = localhost 

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

# The full public facing url 
;root_url = %(protocol)s://%(domain)s:%(http_port)s/ 

# Log web requests 
;router_logging = false 

# the path relative working path 
;static_root_path = public 

# enable gzip 
;enable_gzip = false 

# https certs & key file 
cert_file = /usr/local/ssl/crt/certificate.cer 
cert_key = /usr/local/ssl/private/private_key.key 
+1

您是否检查过grafana日志输出? – AussieDan

+0

@AussieDan悲伤的日志显示什么。 – IIIIIIIIIIIIIIIIIIIIII

+0

如在,它是完全空的?我没有看到你的配置有任何问题,只要证书文件的路径是有效的,并且用户grafana-server运行时可以读取它,它应该可以工作。 – AussieDan

以上配置可能有问题:改变grafana.ini文件后,“grafana服务器”服务将无法再次启动。

以下是我解决我的问题:

  1. 变化grafana.ini如上所述。
  2. 将证书文件(pem,crt和key)复制到/etc/grafana
  3. 将证书文件的文件权限更改为644(go+r),将所有者更改为root:root

之后,grafana服务将在HTTPS模式下正常工作。