Nginx reverse proxy with SSL leads to no connection

Hi everyone, I’ve been trying to set up Grafana 8.3 to run on my server with SSL using Nginx on Ubuntu 20.04 .3 LTS but I just can’t get it to work. I’ve spent a few hours trying to get this working it’s starting to drive me nuts.

I’ve installed Grafana and it works by default from the servers IP address and domain at sub.example.com:3000 with HTTP. But I want to run it with SSL (Let’s Encrypt).

Can someone share with me grafana.ini and nginx configuration that work with SSL?

Thanks in advance.

welcome to the :grafana: forum, @soundium

are you trying to use SSL and still connect on port 3000? I think you will need to set up a proxy pass for that to work. Here is my nginx server block to run Grafana on a subdomain on Ubuntu 20. I got SSL set up using Certbot / lets encrypt


server {
        server_name grafana.zuchka.dev;
        location / {
          proxy_pass   http://127.0.0.1:3000;
        }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/grafana.zuchka.dev/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/grafana.zuchka.dev/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
    if ($host = grafana.zuchka.dev) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        server_name grafana.zuchka.dev;
    listen 80;
    return 404; # managed by Certbot


}
1 Like

Thanks. Now it works!

1 Like

Working now. Many thanks

1 Like