windows xp下设置apache目录访问身份验证(目录访问控制)
一.编辑httpd.conf
加入
Alias /picture/ "E:/picture/"
#设置虚拟目录picture到根目录
<Directory "E:/picture/">
Options Indexes MultiViews
AllowOverride AuthConfig
Order Deny,Allow
Allow from all
Options All
AllowOverride All
</Directory>
二.在E:/picture/下创建.htaccess文件
authtype basic
authname "登陆凡星专区"
authuserfile e:/picture/.htpasswd
require valid-user
三.在E:/picture/下创建密码文件
1.明文密码:
创建pass.txt
内容格式为:username:password
冒号前为用户名,后面为密码,可以放到其他目录,二中的authuserfile的目录也要相应的改动。
2.创建MD5加密的密码文件
在虚拟DOS下进入你的apache目录下的bin目录,输入命令
htpasswd -c e:\picture\.htpasswd fanxing
接下去要求输入两次密码
上面命令行的意思是在E:/picture/下创建密码档.htpasswd
。好了,现在重启apache,在IE里访问picture就要求输入用户名和密码了!
[color=red:21ccfd3b0b]以上部分参考了linux下配置的资料,由谢丹峰@zucc在Windows XP下实践并整理成文,如需转载,请注明出处[/color:21ccfd3b0b]