Welcome to bytea
当前位置: Home 学习资料 网站制作 Apache用户验证的注意事项 今天是...date...

登录bbs

用户名
密码

bytea统计

Members : 43193
Content : 331
Web Links : 69
Apache用户验证的注意事项 PDF Print E-mail
Tuesday, 15 May 2007 08:00
apache服务器中文件或目录的密码的保护网上有不少介绍了,这里稍微总结一下:
1.服务器的设置,主要有两种方法:
    (1) 修改.htaccess文件。,比如加入
    AuthName "Restricted"
    AuthType Basic
    AuthUserFile /path/to/.htpasswd
    require valid-user
  (2)修改apache的
httpd.conf文件,比如加入
        Alias /bytea /usr/local/bytea/share
        <Directory "/usr/local/bytea/share">
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
        AuthName "Bytea.net"
        AuthType Basic
        AuthGroupFile /dev/null
        AuthUserFile /usr/local/bytea/etc/.htpasswd
        Require valid-user
        </Directory>
注意上面只是例子
2. 创建.htpasswd文件,格式是username:encryptedpassword
  可以用命令htpasswd -c
/path/to/.htpasswd username  来创建
  也可以用网上的一些工具来帮忙,比如
.htpasswd creator
3. 重启apache就可以了

下面说说注意事项:
1. .htpasswd文件别放在apache的www目录里
2. apache要启用mod_auth 和 mod_authz_user。 第二个文件在debian里折腾了我半天,不知道其他系统里有没有,如果没启用第二个mod,会导致输入正确的密码之后还是不能登录
3. 如果还有问题,那么可能是encryption不同,试试改 htpasswd的参数
4. last and least 确定apache支持.htaccess rewrite

Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
 

支持本站:


相关文章


Connect with me via QQ:38074 or e-mail:

©2006 bytea.net All Copyrights Reserved.

本站备案编号:保密^_^

RSS:  

开启背景音乐