1、安装httpd
# yum -y install httpd
2、编辑nginx配置文件
在配置中加入:
location / {
root html;
auth_basic "test";
auth_basic_user_file /etc/nginx/conf/password;
}
3、创建文件夹conf
# mkdir /etc/nginx/conf/
4、然后在nginx的conf目录下,执行:
# cd /etc/nginx/conf/
# htpasswd -c password loyu
New password:
Re-type new password:
Adding password for user allowuser
5、重启nginx服务,测试