第三步:重启apache服务并进行访问测试
[root@localhost ~]# service httpd restart
停止 httpd: [确定]
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[确定]
[root@localhost ~]#
//浏览器访问(输入正确的用户名及密码,输入错误则会让重新输入)
//admin用户访问测试
多用户身份验证测试:
第一步:修改身份验证文件,添加多个用户
[root@localhost conf]# cd /etc/httpd/conf
[root@localhost conf]# htpasswd htpasswd admin1
[root@localhost conf]# cat htpasswd
admin:0sGtNjUM21IOI
admin1:JswY/vtvg0OoI
第二步:修改apache配置文件允许多个用户进行身份验证
DocumentRoot /opt/www
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
AuthType basic
AuthName "hello"
AuthUserFile /etc/httpd/conf/htpasswd
Require user admin admin1
第三步:重启apache服务并进行访问测试
[root@localhost ~]# service httpd restart
停止 httpd: [确定]
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[确定]
[root@localhost ~]#
//浏览器访问(输入正确的用户名及密码,输入错误则会让重新输入)
//admin1用户登录测试//admin用户登录测试