← Back to list

How to install grafana com 443 port and use let’s encrypt

Grafana normally runs on port 3000.

Brazolin Walter · 2026-05-25 20:51 · 0 claps · 1.4 min read
#grafana #lets-encrypt #https #ports
Open on Medium ↗

How to install grafana com 443 port and use let’s encrypt

Grafana normally runs on port 3000.

First, update em upgrade your system.

sudo apt update && sudo apt upgrade -y

Install Grafanna keys

sudo apt install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

Add the Official repository:

echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

Install the Grafana

sudo apt install grafana -y

Start the Grafana service and set it to start with the system.

sudo systemctl enable grafana-server
sudo systemctl start grafana-server

Install Nginx with Reverse Proxy

sudo apt install nginx -y

Start the nginx service and set it to start with the system.

sudo systemctl enable nginx
sudo systemctl start nginx

Configure the firewall to allow http and https:

sudo ufw allow 'Nginx Full'
sudo ufw enable

Now, we create the configuration file in Nginx

sudo nano /etc/nginx/sites-available/grafana
    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl http2;
    server_name grafana.yourdomain.io;

    ssl_certificate /etc/letsencrypt/live/yourdomain.io/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.io/privkey.pem;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://localhost:3000/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Now, we activate the configuration

sudo ln -s /etc/nginx/sites-available/grafana /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Obtaining the Let's Encrypt certificate

sudo apt install certbot python3-certbot-nginx -y

sudo certbot --nginx -d yourdomain.io  

Configure your grafana to run behind to HTTPS proxy:

sudo nano /etc/grafana/grafana.ini

Search and Adjust (uncomment if necessary):

[server]
; Protocol (http, https, h2, socket)
protocol = http

; The http port  to use
http_port = 3000

; The public facing domain name used to access grafana from a browser
root_url = %(protocol)s://yourdomain.io/

; Serve Grafana from subpath
; serve_from_sub_path = false

Save and exit

Restart the Grafana

sudo systemctl restart grafana-server

Test!

Did I help you? Buy me a coffee.

buymeacoffee.com/brazolin


메타데이터
post_id
51f7bf2d5cb2
slug
how-to-install-grafana-com-443-port-and-use-lets-encrypt-51f7bf2d5cb2
url
https://medium.com/@brazatech/how-to-install-grafana-com-443-port-and-use-lets-encrypt-51f7bf2d5cb2
canonical_url
https://medium.com/@brazatech/how-to-install-grafana-com-443-port-and-use-lets-encrypt-51f7bf2d5cb2
author_url
https://medium.com/@brazatech
status
ok
fetched_at
2026-06-26 21:52:29