Cài đặt SSL HTTPS Grafana Centos 7

01/11/2021

Grafana SSL

SSL is not installed by default when using the free, self-hosted community edition. If you purchase the cloud version, then SSL is configured automatically by default. You will need sudo access to the servers /etc/grafana/grafana.ini file. Look for the HTTP options:

Grafana HTTP options

There are two key fields that need changing in the Grafana.ini file:

[server]
http_addr = dashboard.yourdomain.co.uk
http_port = 3000
domain = yourdomain.co.uk
root_url = https://grafana.yourdomain.co.uk:3000
cert_key = /etc/grafana/grafana.key
enforce_domain = False
protocol = https
socket =
enable_gzip = False
cert_file = /etc/grafana/grafana.crt
static_root_path = public
router_logging = False

Step 1 – Create an SSL Certificate

I am using Red Hat Linux, but this will work on CentOS as well. You may need to check your appropriate documentation if you are using another flavor of Linux.

From the command line type:

openssl genrsa -out grafana.key 2048

 

You should see output like this:

Grafana, Grafana: How to configure SSL HTTPS in Grafana

Step 2 – Generate a certificate signing request

From the command line type:

openssl req -new -key grafana.key -out grafana.csr

 

You should see output like this:

Grafana, Grafana: How to configure SSL HTTPS in Grafana

Step 3 – Output the certificate

From the command line type:

openssl x509 -req -days 365 -in grafana.csr -signkey grafana.key -out grafana.crt

 

You should see output like this:

Grafana, Grafana: How to configure SSL HTTPS in Grafana
Note: If you type ls -l you will see your certificates

Step 4 – Set certificate key file ownership

From the command line type:

sudo chown grafana:grafana grafana.crt
sudo chown grafana:grafana grafana.key
sudo chmod 400 grafana.key grafana.crt

 

Step 5 – Move certificate and key file to the Grafana installation folder

From the command line type:

sudo mv grafana.crt grafana.key /etc/grafana/

 

Step 6 – Edit the Grafana.ini file

From the command line type:

sudo vim /etc/grafana/grafana.ini
  • Locate the #HTTP options. Set the properties as:

 

protocol = https
cert_key = /etc/grafana/grafana.key
cert_file = /etc/grafana/grafana.crt

 

  • Save and close the file, and now restart the grafana service

 

sudo service grafana-server restart
Grafana, Grafana: How to configure SSL HTTPS in Grafana

 

Step 7 – Browse to the server IP

Now browse to the server IP address and you should be prompted with a warning. As this is a Self Signed Certificate, you will be prompted once like this:

Grafana, Grafana: How to configure SSL HTTPS in Grafana

Note: You will always have to accept this prompt (only once) unless you have purchased a Signed Certificate from a certificate authority vendor such as https://www.digicert.com/

That’s it, thanks for taking the time to read this article. if you have any questions or feedback please write in the comment section below.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Hướng dẫn cấu hình Prometheus thu thập metric trên CentOS7

Hướng dẫn sử dụng Prometheus và Node Exporter giám sát các thông số cơ bản như: uptime, cpu, ram,…...
28/10/2021

Câu hỏi thường gặp khi mua và sử dụng proxy

1)Tôi có thể mua proxy cho nhưng nước nào? Trả lời: Hiện tại chúng tôi đang triển khai cho thuê proxy...
09/11/2022

Sử dụng Proxy để Quản Lý Tài Khoản Quảng Cáo Ads Một Cách An Toàn

Lý Do Mua Proxy HTTP & SOCKS5 giá rẻ tại Onet.com.vn Tốc độ cao – proxy của chúng tôi...
27/05/2023
Bài Viết

Bài Viết Mới Cập Nhật

Huớng dẫn dùng proxy cho ios, iphone 2023
23/09/2023

Cách gắn set proxy cho điện thoại android, oppo, giả lập android, Ldplayer Bằng Proxydroid
20/09/2023

Mua Proxy Socks5 VN Chơi Game Gia Lập Tăng Cường Trải Nghiệm Chơi Game
22/06/2023

Mua Proxy Mỹ, Us Nuôi Tài Khoản Etsy, eBay Tìm Hiểu Về Mua Proxy Mỹ tại Onet.com.vn
22/06/2023

Mua Proxy Game – Giải pháp tuyệt vời cho việc chơi game trên mạng mà không bị giới hạn về vị trí địa lý
03/06/2023