Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grafana switch from http to https

Tags:

grafana

I have successfully running a grafana instance on my server. It runs on http without a problem. Now I want to switch from http to https. My grafana.ini is shown bellow:

#################################### 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
like image 245
IIIIIIIIIIIIIIIIIIIIII Avatar asked Oct 10 '16 11:10

IIIIIIIIIIIIIIIIIIIIII


People also ask

Does Grafana use Apache?

The Apache service will listen on TCP port 80, authenticate and redirect users to the Grafana service on port 3000. To test your Apache proxy installation, open your browser and enter the IP address of your server. The Apache proxy will request you to authenticate yourself before forwarding you to the Grafana service.


2 Answers

The above configuration may have a problem: after changing the grafana.ini file the "grafana-server" service will not start again.

Here's how I solved my problem:

  1. Change grafana.ini as mentioned above.
  2. Copy the certificate files (pem, crt and key) to /etc/grafana.
  3. Change the file permissions of the certificate files to 644 (go+r) and the owner to root:root.

After that the grafana service will work properly in HTTPS mode.

like image 158
mojdeh Avatar answered Oct 23 '22 16:10

mojdeh


Suggest give certificate and key files the same permission as other files under /etc/grafana. chgrp grafana ; chmod 640

like image 36
lijun1234 Avatar answered Oct 23 '22 16:10

lijun1234