nginx添加basic表单认证

nginx添加basic表单认证

nginx给网站添加basic表单认证

很多大数据组件的adminUI 并没有设计授权认证,可以通过nginx 做一个简单的用户名密码认证:

  1. 生成密码文件
1
2
3
4
yum install httpd-tools -y

#输入密码,就会生成加密的用户密码文件
htpasswd -c /etc/nginx/conf.d/.ngpasswd admin

2 nginx 加上 auth_basic信息

1
2
3
4
5
6
#配置nginx
location /flink/ {
auth_basic "input you user name and password";
auth_basic_user_file /etc/nginx/conf.d/.ngpasswd;
proxy_pass http://flink-01:8081;
}

访问 http://{server_name}:{port}/flink 时,就会自动弹出 验证框


Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×