步骤一 : 创建用户名密码
# 创建用户名密码文件 htpasswd -dbc htpasswd.users user password
密码也可以通过openssl passwd password 来创建
格式为 user:encrypr_ password
可以多个
步骤二 : Nginx配置
server { listen 80; server_name xxx.com; location / { auth_basic "Restricted Access"; auth_basic_user_file htpasswd.users; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8001; proxy_next_upstream error timeout http_500; } }
标签:创建,nginx,htpasswd,user,Basic,password,Authorization,proxy From: https://www.cnblogs.com/kreo/p/17446424.html