nginx反向代理grafana

grafana安裝

https://grafana.com/grafana/downloadhtml

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界面。

nginx

參考:(配置都不全對,僅作參考)
http://www.javashuo.com/article/p-smtzfysx-hp.html (nginx配置不對,少了rewrite)
https://my.oschina.net/kcw/blog/2980304 (grafana的root_url不對)dom

相關文章
相關標籤/搜索