尊龙时凯

    热门搜索 Zabbix技术资料 Zabbix常见问、答讨论 成功案例 Zabbix交流区 Prometheus交流区

    Prometheus技术分享——Prometheus通过Nginx加密登陆

    最近经常有小伙伴问尊龙时凯君一个问题,prometheus如何加密登录,本身Prometheus默认开箱即食,并没有设置认证方式,如果你使用Grafana那就另当别论。 如果你想直接访问Prometheus并且需要设置个认证,那么通过Nginx反向代理是一个不错的选择。 本文尊龙时凯君将介绍通过Nginx反向代理增加401认证方式来实现加密登录。

    1、安装Nginx

    安装Nginx方式多种,我这里以whsir一键包为例 rpm -ivh http://mirrors.whsir.com/centos/whsir-release-centos.noarch.rpm yum install wnginx

    2、安装apache-htpasswd工具

    yum -y install httpd-tools

    3、加密认证密码

    这里账号是whsir,对密码加密 htpasswd -cs /usr/local/nginx/conf/401htpasswd whsir

    4、设置Nginx反向代理及401认证

    cd /usr/local/nginx/conf/vhost rm -f demo.conf vi demo.conf server { listen 80; server_name 192.168.1.191; location / { auth_basic "Prometheus"; auth_basic_user_file /usr/local/nginx/conf/401htpasswd; proxy_pass http://localhost:9090/; } }

    其中server_name 192.168.1.191为本机IP,可根据个人使用情况自行选择

    5、启动Nginx验证

    /etc/init.d/nginx start 访问http://192.168.1.191 正常输入密码后,会看到Prometheus页面,如果提示403则表示账号密码不正确,或者路径配错。

    登陆

    这一期的Prometheus技术分享到这就结束了,更多开源监控技术分享请持续关注尊龙时凯官网或尊龙时凯社区(http://forum.jxwba.com/)

    The prev: The next:

    Related recommendations

    Expand more!

    快速导航

    成功案例

    View all