实战apache用户验证

王朝system·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

本文主要介绍了包含在apache发行版本内的用户验证模块---auth,auth_db

验证模块的使用是很简单的就以下三步

1、创建用于保存用户/密码的文件

2、配置apache以使用那个文件做用户验证

3、可选的创建一个组文件

1、apache_1.3.28的安装。

shell>./configure --prefix=/www --disable-module=all --enable-module=access --enable-module=so --enable-shared=max --enable-module=auth_anon --enable-module=auth --enable-module=auth_db --enable-module=auth_dbm --enable-module=digest --enable-module=alias --enable-module=log_config --enable-module=dir --enable-module=mime

shell>make

shell>make intall

2、创建需要的目录

mkdir /www/auth

mkdir /www/authdb

chown nobody:nobody /www/auth /www/authdb

3、编辑httpd.conf

Alias /auth /www/auth

Alias /authdb /www/authdb

<Directory /www/auth>

AllowOverride AuthConfig

</Directory>

<Directory /www/authdb>

AllowOverride Authconfig

</Directory>

AuthType Basic

4、在/www/auth,/www/authdb中分别创建.htaccess文件

vi /www/auth/.htaccess

AuthName "password file auth"

AuthUserFile /www/authfile/password

AuthGroupFile /www/authfile/group

Require group test

vi /www/authdb/.htaccess

AuthName "db auth"

AuthDBUserFile /www/authfile/dbuser.dat

Require username1

5、创建密码文件

/www/bin/htpasswd -c /www/authfile/password username1

/www/bin/htpasswd /www/authfile/password username2

创建组文件

echo "test: username1 username2" >> /www/authfiile/group

6、创建密码数据库用于数据库验证

/www/bin/dbmmanage /www/authfile/dbuser.dat adduser username1

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航