标签:nginx ngnix认证 ngnix+kibana认证
kibana登陆认证采用nginx+ apache htpassword实现,具体步骤如下:
(1)安装nginx,httpd
yum install nginx
yum install httpd
如果没有安装yum,也可以到相应的官网下载对应的安装包,此处不阐述。
(2)htpassword文件的生成
htpasswd -c -b htpasswd.kibana username password
其中username和password根据实际修改,此时通过apahce htpassword生成认证的用户和密码。
(3)将认证文件放到ngnix目录下
mv htpasswd.kibana /etc/nginx/
(4)vim /etc/nginx/conf.d/kibana.conf
server { listen 80; server_name 10.10.1.2; #主机名 auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/htpasswd.kibana; #登录验证 location / { proxy_pass http://192.168.1.2:5601; #转发到kibana,kibana ip配置成内网 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection ‘upgrade‘; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } |
(5)create user nginx
chattr -i /etc/passwd /etc/group /etc/shadow /etc/gshadow
useradd -s /sbin/nologin nginx
chattr +i /etc/passwd /etc/group /etc/shadow /etc/gshadow
(6)start service
service nginx start
如果报错:
nginx: [error] invalid PID number "" in "/var/run/nginx.pid"
则如下处理:
nginx -c /etc/nginx/nginx.conf
nginx -s reload
(7)访问10.10.1.2
输入用户密码即可进入kibana页面。
本文出自 “蓦然回首” 博客,请务必保留此出处http://linyongzhi.blog.51cto.com/2540209/1915743
标签:nginx ngnix认证 ngnix+kibana认证
原文地址:http://linyongzhi.blog.51cto.com/2540209/1915743