vim /etc/nginx/nginx.confAuth_basic 用来支持http的基本认证(用户和密码的认证)

nginx #启动
nginx -s reload #重启加载配置文件
nginx -t #检查配置文件安装htpasswd命令
#查找命令对对应的安装包
yum provides htpasswd 
yum -y install httpd-tools创建一个文件
[root@ok ~]# htpasswd -c /etc/nginx/.htpasswd test
New password:
Re-type new password:
Adding password for user test如果想添加多个用户的话 直接进文件进行添加 先从网上获取加密后的密码 htpasswd在线生成器:https://tool.oschina.net/htpasswd
vim /etc/nginx/.htpasswd
