栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

nginx 代理grafana

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

nginx 代理grafana

grfana系列文章目录

提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加
例如:第一章 Python 机器学习入门之pandas的使用


`配置文件
第五章 grafana使用CDN模式进行页面加速
第六章 nginx代理grafana


前言

在上一章中grafana已经使用CDN模式进行了加速,在这里将把grfana放到后端,一切访问都将通过nginx来访问。


提示:以下是本篇文章正文内容,下面案例可供参考

一、在nginx中添加一个虚拟服务器

这里使用8081 端口对外进行服务
需要注意的是在nginx中独立配置ws的部分,如果没有配置将会发现如下错误:
1) 在浏览器里可以发现:

2) 在nginx的错误日志中:

server {
    listen       8081;
    listen  [::]:8081;
    server_name  192.168.1.122;

    access_log  /var/log/nginx/host.access.log  main;
    error_log /var/log/nginx/host.error.log warn;


    location / {
                add_header Access-Control-Allow-Origin *;
                proxy_pass http://192.168.1.120:3000;
                 proxy_http_version 1.1;
                    log_not_found off;
                    proxy_set_header Host $http_host;
                    #proxy_set_header Host $host:$server_port;

                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_redirect off;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header X-Forwarded-Proto $scheme;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
                    proxy_connect_timeout 10000;
                    proxy_read_timeout 10000; #超时配置一定要


    }

}

二、对于403 forbidden 错误

需要修改granfa的配置文件

[server]
# Protocol (http, https, h2, socket)
protocol = http

# The ip address to bind to, empty will bind to all interfaces
;http_addr =

# The http port  to use
http_port = 3000

# The public facing domain name used to access grafana from a browser
domain = 192.168.1.120  # 这里写入在浏览器中显示的地址

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
enforce_domain = true  # 这里需要从false改成true

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/920770.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号