Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.47 KB

prometheus_behind_reverse_proxy.rst

File metadata and controls

30 lines (19 loc) · 1.47 KB

在反向代理后面运行Prometheus

在反向代理后面采用 sub-path 的Prometheus

prometheus_startup_centos7 采用 nginx_reverse_proxy ,使用的是 sub-path 模式,也就是说我的访问域名 onesre.cloud-atlas.io 的子路径 http://onesre.cloud-atlas.io/prometheus/ 反向代理到运行 prometheus_startup 部署的服务器:

  • 配置 /etc/nginx/conf.d/onesre-core.conf 设置反向代理:

prometheus_behind_reverse_proxy/sub-path_nginx.conf

  • 此时访问页面会报错的,需要修订 /etc/systemd/system/prometheus.service 添加 --web.external-url 运行参数:

prometheus_behind_reverse_proxy/prometheus.service

重启 prometheus.service 之后,就能正常通过 http://onesre.cloud-atlas.io/prometheus/ 反向代理访问新部署的 prometheus_startup_centos7

参考