|
//在2CTO.COM网站的跟目录下建立一个文件.htaccess,并且编辑
Authname "2CTO.COM"
AuthType Basic
AuthUserFile /etc/httpd/vconf.d/2CTO.COM.htpasswd
Require valid-user
//建立2CTO.COM 域的密码文件,并且文件必须被apache组可读
[root@centos129 2CTO.COM]# htpasswd -cm /etc/httpd/vconf.d/2CTO.COM.htpasswd zhoutao
New password:
Re-type new password:
Adding password for user zhoutao
chgrp apache /etc/httpd/vconf.d/2CTO.COM.htpasswd
chmod g+r /etc/httpd/vconf.d/2CTO.COM.htpasswd
//添加虚拟主机配置文件中增加
AllowOverride AuthConfig
//测试
访问www.2CTO.COM 提示输入密码,
成功进入
|
|