[转贴-半]windows xp下设置apache目录访问身份验证(目录访问控制)方案
http://www.99power.com/wz_109095/windows xp下设置apache目录访问身份验证(目录访问控制)方案
一.编辑httpd.conf
加入
Alias /picture/ "E:/picture/"
#设置虚拟目录picture到根目录
Options Indexes MultiViews
AllowOverride AuthConfig
Order Deny,Allow
Allow from all
Options All
AllowOverride All
二.在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就要求输入用户名和密码了!
以上部分参考了linux下配置的资料,由谢丹峰@zucc在Windows XP下实践并整理成文,如需转载,请注明出处
补充
也可以这样
编辑httpd.conf
Options Indexes FollowSymlinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
AuthType Basic
AuthName "protected area!"
AuthUserFile f:/web/test/passwd.txt
#require user 123
require valid-user
以下为原创
http://www.iyunv.com/gudai/archive/2006/09/27/516097.html
用socket模拟和服务器通信只要在发送的http头里增加一个参数
Authorization: Basic 认证变量
认证变量为base64对id和password的值对编码得到的字串
$user=1;
$pass=1;
$userid_password = base64_encode($user . ":".$pass);
$headAuth ="Authorization: Basic ".$userid_password;
花了我四个小时,NND.
页:
[1]