grafana从http切换到https

grafana从http切换到https,grafana,Grafana,我已在服务器上成功运行grafana实例。它在http上运行,没有问题。现在我想从http切换到https。我的grafana.ini如下所示: #################################### Server #################################### [server] # Protocol (http or https) protocol = https # The ip address to bind to, empty will bi

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

#################################### 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

上述配置可能有问题:更改
grafana.ini
文件后,“grafana服务器”服务将不会再次启动

以下是我解决问题的方法:

  • 如上所述更改
    grafana.ini
  • 将证书文件(pem、crt和密钥)复制到
    /etc/grafana
  • 将证书文件的文件权限更改为644(
    go+r
    ),将所有者更改为
    root:root

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

    建议授予证书和密钥文件与/etc/grafana下的其他文件相同的权限。
    格拉法纳;chmod 640

    你检查过grafana日志输出了吗?@AussieDan很遗憾,日志没有显示任何内容。如中所示,它是完全空的?我看不出您的配置有任何问题,只要指向证书文件的路径有效,并且用户grafana服务器可以读取它们就可以运行。@AussieDan不,它们不是空的,但没有任何与我的问题相关的内容。嗯,好的,我查一下that@BitcoinMurderousManiac是的,我让它工作了。Sry我忘了将问题标记为已解决->修复了如果更新证书,请不要忘记重新启动grafana服务器您确实救了我的命:D我在证书上犯了相同的错误。还有一件事要提。考虑取消对grafana.ini文件中的行的注释。Uncomment=删除该命令;在行首。我花了半个小时才弄明白这一点……顺便说一句,用
    sudo服务重新启动Grafana服务器,正如前面所说的那样。