Skip to content


 Zabbix
 Grafana
 Prometheus
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$6.99 $9.99 Paperback 
$22.99 $29.99




Design Patterns in TypeScript
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99




Design Patterns in Python
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99




Reverse Proxy Grafana with Nginx

Video Lecture

Reverse Proxy Grafana with Nginx Reverse Proxy Grafana with Nginx Reverse Proxy Grafana with Nginx

Description

Now to add a proxy. I will use Nginx. The Nginx proxy will also allow us to more easily configure our Grafana servers public address and bind an SSL certificate to it. It is possible to change the grafana.ini settings to use a specific port number, SSL certificates and HTTP protocol instead, but you will also need to manage file permissions that the Grafana server process will need. It is more versatile to use a dedicated proxy and especially if your server will be hosting multiple web applications.

Check if Nginx is installed

nginx -v

No, then install it with

sudo apt install nginx

Now check its version

nginx -v

Now check its status

sudo service nginx status

Visit http://[your ip address]

You should get the default Nginx web server index.html.

CD to the Nginx sites-enabled folder

cd /etc/nginx/sites-enabled

Create a new Nginx configuration for Grafana

sudo nano YOUR-DOMAIN-NAME.conf

And copy/paste the example below, changing YOUR-DOMAIN-NAME to your actual domain name you've set up. Mine was grafana.sbcode.net.

server {
    listen 80;
    listen [::]:80;
    server_name  YOUR-DOMAIN-NAME;

    location / {
        proxy_set_header Host $http_host;
        proxy_pass           http://localhost:3000/;
    }
}

Save and restart Nginx

sudo service nginx restart
sudo service nginx status

Test it by visiting again

http://YOUR-DOMAIN-NAME

Visiting your IP address directly will still show the default Nginx welcome page. If you don't want this to happen, then you can delete its configuration using the command below.

rm /etc/nginx/sites-enabled/default

Grafana 9 and Ubuntu 22.04 Notes

Proxy Set Header

In later versions of Grafana 8 and version 9, the nginx configuration requires the extra line setting the proxy header for the location node.

I.e.,

server {
    listen 80;
    listen [::]:80;
    server_name  YOUR-DOMAIN-NAME;

    location / {
        proxy_set_header Host $http_host;
        proxy_pass           http://localhost:3000/;
    }
}

Daemons using outdated libraries

Since Ubuntu 22.04, installing new packages may give you a full screen prompt to restart other dependent services. Press Tab to highlight the OK option, and press Enter.