nginx反向代理grafana

grafana安装

https://grafana.com/grafana/download

Nginx设置如下:

    location /grafana {
        root   html;
        index  index.html index.htm;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS,DELETE;
        add_header 'Access-Control-Allow-Headers' 'userId,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
        proxy_pass http://127.0.0.1:3000;
        rewrite ^/grafana/(.*) /$1 break;
        proxy_set_header   Host $host;
    #server_name_in_redirect off;
    #proxy_set_header Host $host:$server_port;
    #proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header REMOTE-HOST $remote_addr;
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

grafana配置文件修改如下配置:

#在/etc/grafana/grafana.ini配置文件中修改
domain = localhost
root_url = %(protocols)s://%(domain)s/grafana

访问 ip/grafana 即可看到grafana界面。

参考:(配置都不全对,仅做参考)
https://blog.csdn.net/felix_yujing/article/details/72793863 (nginx配置不对,少了rewrite)
https://my.oschina.net/kcw/blog/2980304 (grafana的root_url不对)

猜你喜欢

转载自www.cnblogs.com/dylanchu/p/10252503.html
今日推荐