nginx 账号认证功能
//创建账号密码
yum -y install httpd-tools
mkdir -p /usr/share/nginx/passwd
htpasswd -cbm /usr/share/nginx/passwd/.htpasswd user1 123456
htpasswd -bm /usr/share/nginx/passwd/.htpasswd user2 123456
//修改nginx配置文件
location = /login {
root /usr/share/nginx/html/;
index index.html;
auth_basic "login password";
auth_basic_user_file /usr/share/nginx/passwd/.htpasswd;
}
nginx -s reload
输入账号密码后可以看到内容
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/282991.html