nginx 用户登录认证
1、配置nginx
server { listen 80; server_name kibana.×××.com; location / { auth_basic "secret"; auth_basic_user_file /etc/nginx/db/passwd.db; proxy_pass http://****:5601; proxy_set_header Host $host:5601; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; } access_log off; }
2、配置登录用户名(admin),密码
htpasswd -c /etc/nginx/db/passwd.db admin New password: Re-type new password: Adding password for user admin
htpasswd是apache自带的小工具,如果找不到该命令,尝试用yum install httpd安装
cat db/passwd.db
admin:$apr1$Jc.x0rme$BWrmulBqUj.g6BeeoEM79/