亚洲韩日午夜视频,欧美日韩在线精品一区二区三区,韩国超清无码一区二区三区,亚洲国产成人影院播放,久草新在线,在线看片AV色

您好,歡迎來(lái)到思海網(wǎng)絡(luò),我們將竭誠(chéng)為您提供優(yōu)質(zhì)的服務(wù)! 誠(chéng)征網(wǎng)絡(luò)推廣 | 網(wǎng)站備案 | 幫助中心 | 軟件下載 | 購(gòu)買流程 | 付款方式 | 聯(lián)系我們 [ 會(huì)員登錄/注冊(cè) ]
促銷推廣
客服中心
業(yè)務(wù)咨詢
有事點(diǎn)擊這里…  531199185
有事點(diǎn)擊這里…  61352289
點(diǎn)擊這里給我發(fā)消息  81721488
有事點(diǎn)擊這里…  376585780
有事點(diǎn)擊這里…  872642803
有事點(diǎn)擊這里…  459248018
有事點(diǎn)擊這里…  61352288
有事點(diǎn)擊這里…  380791050
技術(shù)支持
有事點(diǎn)擊這里…  714236853
有事點(diǎn)擊這里…  719304487
有事點(diǎn)擊這里…  1208894568
有事點(diǎn)擊這里…  61352289
在線客服
有事點(diǎn)擊這里…  531199185
有事點(diǎn)擊這里…  61352288
有事點(diǎn)擊這里…  983054746
有事點(diǎn)擊這里…  893984210
當(dāng)前位置:首頁(yè) >> 技術(shù)文章 >> 文章瀏覽
技術(shù)文章

mod_auth_mysql 在Apache 2.0下的安裝和使用

添加時(shí)間:2011-3-1  添加: admin 

:  mod_auth_mysql 是一款很好的基于數(shù)據(jù)庫(kù)對(duì)Apache 用戶的模塊,目前已經(jīng)加入 Apache 模塊庫(kù),而且最新版本支持 Apache 2.0。

這款軟件已經(jīng)在 FreeLAMP.com 上實(shí)施,現(xiàn)把實(shí)施過(guò)程作簡(jiǎn)要介紹。

這款軟件的作者是 Ueli Heuer,其主頁(yè)位于

http://www.heuer.org/mod_auth_mysql/.

安裝說(shuō)明十分簡(jiǎn)單,其英文原文可以看下面的連接:

http://www.heuer.org/mod_auth_mysql/INSTALL

這個(gè)模塊目前只支持 Apache 2.0 ,安裝采用 DSO 方式:

假設(shè) Apache 2.0.36 安裝于 /opt/httpd-2.0.36 ,那么運(yùn)行的命令是:

/opt/httpd-2.0.36/bin/apxs -c -L /usr/local/mysql/lib/mysql mod_auth_mysql.c
/opt/httpd-2.0.36/bin/apxs -i mod_auth_mysql.la

你只要下載主頁(yè)上的那個(gè) mod_auth_mysql.c 就可以了。

然后在你的 MySQL 數(shù)據(jù)庫(kù)上建立一個(gè)新的數(shù)據(jù)庫(kù),實(shí)際上使用原來(lái)存在的數(shù)據(jù)庫(kù)也沒有關(guān)系,只要新建的表名不和原來(lái)的表名重復(fù)就可以,但是為了安全考慮,建議建立單獨(dú)的數(shù)據(jù)庫(kù)。

建立數(shù)據(jù)庫(kù)后,可以把下載主頁(yè)上的那個(gè) htpasswd.sql 導(dǎo)入到新的數(shù)據(jù)庫(kù),這個(gè) SQL 文件建立了三個(gè)表:

user_info:用戶信息
user_group:用戶的組
host_info:主機(jī)信息

#
# Table structure for table `host_info`
#
# the fields created, updated, and isadmin are not needed by the module!
# they may help you creating a php-htpasswd frontend
#

CREATE TABLE host_info (
id int(14) NOT NULL auto_increment,
host char(255) NOT NULL default '',
host_group int(14) NOT NULL default '0',
created timestamp(14) NOT NULL,
updated timestamp(14) NOT NULL,
PRIMARY KEY (id),
KEY host (host)
) TYPE=MyISAM PACK_KEYS=1;
# --------------------------------------------------------

#
# Table structure for table `user_group`
#

CREATE TABLE user_group (
id int(14) NOT NULL auto_increment,
user_name char(50) NOT NULL default '',
user_group char(20) NOT NULL default '',
host_group int(14) default NULL,
created timestamp(14) NOT NULL,
updated timestamp(14) NOT NULL,
PRIMARY KEY (id),
KEY host_group (host_group),
KEY user_group (user_group)
) TYPE=MyISAM PACK_KEYS=1;
# --------------------------------------------------------

#
# Table structure for table `user_info`
#

CREATE TABLE user_info (
id int(14) NOT NULL auto_increment,
user_name char(30) NOT NULL default '',
user_passwd char(20) NOT NULL default '',
host_group int(14) NOT NULL default '0',
created timestamp(14) NOT NULL,
updated timestamp(14) NOT NULL,
isadmin tinyint(4) NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY user_name (user_name,host_group)
) TYPE=MyISAM PACK_KEYS=1;

從以上三個(gè)表的結(jié)構(gòu),我們可以看到,其中最主要的就是 host_group 的一致,
user_info 的 host_group 和 host_info 的 host_group 要對(duì)應(yīng)起來(lái),user_info 的其他字段,例如 isadmin,created,updated 等都還沒有使用,用于以后擴(kuò)展。
因此,一個(gè)簡(jiǎn)單的插入數(shù)據(jù)的例子就是:
insert into host_info (host) values ("www.freelamp.com");
insert into user_info (user_name,user_passwd) values ("albertxu",encrypt("my_log_passwd"));

然后修改 httpd.conf 加入:

LoadModule auth_mysql_module modules/mod_auth_mysql.so

AuthType Basic

AuthMySQLHost localhost ;連接數(shù)據(jù)庫(kù)的主機(jī)地址,一般用本地連接,所以為 localhost
AuthMySQLUser apache auth ;連接數(shù)據(jù)庫(kù)的用戶名
AuthMySQLPassword my_secret_pass ;連接數(shù)據(jù)庫(kù)的口令
AuthMySQLDB apache ;數(shù)據(jù)庫(kù)的名字
AuthSQLAuthoritative On
AuthSQLKeepAlive off

需要認(rèn)證的目錄下的 .htaccess 文件,要把 AuthUserFile 這項(xiàng)去掉。其他可以保持不變。

Authname "FreeLAMP.com Log Detail"
Authtype Basic
Require user albertxu

這樣一個(gè)可以針對(duì)大型虛擬主機(jī)的認(rèn)證系統(tǒng)就建立起來(lái)了。

最后需要特別說(shuō)明的是:user_info 表中的 user_passwd 字段是采用 mysql 的 encrypt()加密的,而不是 password() ,更不是明碼。這個(gè)在文檔上面沒有說(shuō)明,我電子郵件給 Ueli Heuer 先生,便很快得到了回答:

=================================================================
On Mon, 27 May 2002 23:20:30 +0800
"Xu" wrote:
Hi Albert,
The problem are the clertext passwords in the db. You need to encrypt this with the
encrypt() function from mysql or with the unix password crypt() function.
Did you check the errorlog form apache? mod_auth_mysql writes some hints if somethings
fails (e.g. dbconenction fails, host is not in the db, and so on
as an example:
[Mon May 27 17:52:04 2002] [error] [client 192.168.1.39] password mismatch on
deadeye.maillink.ch: http://test:versuch@deadeye.heuer.org/
Hope it helps
Greetz
Ueli

關(guān)鍵字:mod_auth_mysql Apache 2.0 安裝 使用

分享到:

頂部 】 【 關(guān)閉
版權(quán)所有:佛山思海電腦網(wǎng)絡(luò)有限公司 ©1998-2024 All Rights Reserved.
聯(lián)系電話:(0757)22630313、22633833
中華人民共和國(guó)增值電信業(yè)務(wù)經(jīng)營(yíng)許可證: 粵B1.B2-20030321 備案號(hào):粵B2-20030321-1
網(wǎng)站公安備案編號(hào):44060602000007 交互式欄目專項(xiàng)備案編號(hào):200303DD003  
察察 工商 網(wǎng)安 舉報(bào)有獎(jiǎng)  警警  手機(jī)打開網(wǎng)站