Nginx反向代理Grafana服务的配置步骤
一级路径的配置方式
只需要修改nginx配置文件,主要是增加对WebSocket的支持及反向代理的配置
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
location / {
proxy_pass http://localhost:3000/;
}
location /api/live {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000/;
}
}
重新载入nginx配置文件
/usr/local/nginx/sbin/nginx -s reload
二级路径路径的配置方式
除了需要修改nginx配置文件外,还需要修改grafana配置文件
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
location ^~ /grafana/ {
proxy_pass http://localhost:3000/;
}
location ^~ /grafana/api/live {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_pass http://localhost:3000/;
}
}
重新载入nginx配置文件
/usr/local/nginx/sbin/nginx -s reload
修改grafana.ini配置文件
vi /etc/grafana/grafana.ini
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana
serve_from_sub_path = true
重启Grafana服务
systemctl restart grafana-server
相关推荐
-
Nginx反向代理Grafana服务的配置步骤2025-02-27 00:25:52
-
PHP中实现Timer功能使用pcntl和libevent2025-02-27 00:25:43
-
nginx-UrlRewrite 实现URL重写转发2025-02-27 00:22:24
-
Linux 下配置nginx到php的连接2025-02-27 00:10:50
-
Linux下查看Nginx等的并发连接数和连接状态2025-02-27 00:08:26