#安装httpd
yum install httpd-tools -y
#添加账密
htpasswd -c /etc/nginx/conf.d/.passwd username
#回车后输入密码
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
auth_basic “input you user name and password”;
auth_basic_user_file /etc/nginx/conf.d/.passwd;
proxy_pass http://127.0.0.1:8081;
}
}