//创建账号密码 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
输入账号密码后可以看到内容