网站首页 > 技术教程 正文
目的:
通过Nginx服务器对grafana进行代理,实现通过https://域名/grafana在公网进行访问
实践过程:
1、修改Nginx配置(nginx.conf)文件,添加访问grafana的配置,配置时注意proxy_pass后面一定要有符号 /(目的是去掉/grafana/以匹配本身)
vi /usr/local/nginx/conf/nginx.conf
server {
listen 443 ssl;
server_name example.com;
ssl_certificate cert/example.com.pem;
ssl_certificate_key cert/example.com.key;
location / {
root html;
index index.html index.htm;
}
location /grafana/ {
root html;
index index.html index.htm;
proxy_pass http://192.168.31.90:3000;
proxy_redirect default;
proxy_max_temp_file_size 0k;
proxy_connect_timeout 30;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_next_upstream error timeout invalid_header http_502;
}
}
2、修改grafana服务器的配置文件(grafana.ini),注意需要去掉行前的注释符号 “;”
[server]段涉及以下三处需要更改:
[server]
domain = 填写你的域名地址
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
3、reload Nginx并重启grafana服务
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload
systemctl restart grafana-server
4、最后提供下官方文档中关于转发的配置说明:
grafana之proxy转发说明
https://grafana.com/tutorials/run-grafana-behind-a-proxy/#1
转发配置如下:
[server]
domain = example.com
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true
猜你喜欢
- 2024-10-10 使用 nginx 同域名下部署多个 vue 项目,并使用反向代理
- 2024-09-12 踩坑记录之MinIO添加HTTPS访问(邮箱访问记录多地登录失败是否意味着邮箱被侵入)
- 2024-09-12 申请免费证书、域名解析以及nginx部署配置https为微信小程序服务
- 2024-09-12 Nginx快速入门之Nginx反向代理与负载均衡
- 2024-09-12 宝塔面板如何用uwsgi与nginx快速部署Django项目
- 2024-09-12 使用 nginx 实现在同一个微信公众号授权域名下访问正式版和测试版
- 2024-09-12 使用nginx:1.24.0-bullseye部署Nginx域名、端口、子目录配置方法
- 2024-09-12 Nginx实现301跳转至https的根域名展示
- 2024-09-12 关于TP3.2 nginx下配置子域名(nginx 配置php)
- 2024-09-12 通过Nginx完美解决多个项目共用一个端口「80、443等等」
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)