Nginx のリバースプロキシーで Grafana につなぐ方法です。
Nginx の設定
/etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
(省略)
location /grafana/ {
proxy_pass http://localhost:3000/;
}
}
Nginx の設定の確認
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Grafana の設定
/etc/grafana/grafana.ini
(省略)
domain = localhost
root_url = %(protocol)s://%(domain)s/grafana/
(省略)
サーバーの再起動
sudo systemctl restart grafana-server
sudo systemctl restart nginx