grafana 从 http 切换到 https
grafana switch from http to https
我已经在我的服务器上成功 运行 了一个 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-server"服务将不会再次启动。
这是我解决问题的方法:
- 如上所述更改
grafana.ini
。
- 将证书文件(pem、crt 和密钥)复制到
/etc/grafana
。
- 将证书文件的文件权限更改为 644 (
go+r
) 并将所有者更改为 root:root
。
之后grafana服务将在HTTPS模式下正常运行
建议给予证书和密钥文件与/etc/grafana下的其他文件相同的权限。
chgrp 格拉法纳; chmod 640
我已经在我的服务器上成功 运行 了一个 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-server"服务将不会再次启动。
这是我解决问题的方法:
- 如上所述更改
grafana.ini
。 - 将证书文件(pem、crt 和密钥)复制到
/etc/grafana
。 - 将证书文件的文件权限更改为 644 (
go+r
) 并将所有者更改为root:root
。
之后grafana服务将在HTTPS模式下正常运行
建议给予证书和密钥文件与/etc/grafana下的其他文件相同的权限。 chgrp 格拉法纳; chmod 640