Windows下mod_auth_mysql.so的编译和配置
一、首先下载Windows下的源程序打包文件:http://www.rpmcenter.org/win32/ 该压缩包内已包含编译好,可以直接使用的mod_auth_mysql.so文件,也可以参照里面的HOWTO.Win32.txt来自己编译:
BUILDING mod_auth_mysql for Win32
Assume you are using Visual Studio 6.0 (should be similar for Visual Studio.net/2003/2005):
-
Download Apache2 2.0.55 win32 source file from one of the apache mirror, for example: http://www.apache.org/dist/httpd/httpd-2.0.55-win32-src.zip
- You should avoid using the main site, select from a mirror from http://httpd.apache.org
-
Extract the Apache2 2.0.55 win32 source file to a location you like (for example C:/)
-
Copy httpd-2.0.55 directory in this zip file to the location you extracted Apache2 (ie. C:/) 说明:此处我是把解压出来的mod_auth_mysql目录(mod_auth_mysql-3.0.0-for-Win32-mysql5.0.15-and-apache2.0.55/httpd-2.0.55/mod_auth_mysql)直接剪切下来,放到apache源代码目录的modual目录(apache/httpd-2.0.55/modules) 说明:由于我们已经安装了MySQL,4、5步可以不需要了。
-
Since MySQL5 is no longer compiled with VS6.0, you need to build mysql win32 from source also: http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.15-win-src.zip/from/pick
-
Extract MySQL source and Build All
-
Open Apache dsw and add mod_auth_mysql Project 说明:VS6的Project菜单下选择insert projects into workspace,然后选择我们拷贝到Apache目录的dsp文件:/apache/httpd-2.0.55/modules/mod_auth_mysql/mod_auth_mysql.dsp
-
Specify the mysql include and lib locations in your Visual Studio environment 此处可以直接使用安装好的MySQL的Lib目录(E:/MySQL/lib/opt)和include目录(E:/MySQL/include) 在VS6的Tools/Options/Directorys/include选项下面添加:E:/MySQL/include 在VS6的Tools/Options/Directorys/Lib选项下面添加:E:/MySQL/lib/opt
-
Build mod_auth_mysql.so(Build菜单下满选择Set active configuration,选择mod_auth_mysql -Win32 release)
Enjoy!
CONFIGURING mod_auth_mysql for Win32
Please read CONFIGURE.txt for more information
二、将mod_auth_mysql.so拷贝到Apache2的安装目录的modual目录下 三、修改httpd.conf: 1、在LoadModule段的末尾,增加装载模块的语句: LoadModule mysql_auth_module modules/mod_auth_mysql.so 注意这里模块的名字是mysql_auth_module,写错了就会报错。 如果名字写成 "auth_mysql_module" ,就会出现以下错误信息: Syntax error on line 181 of E:/Apache2/conf/httpd.conf: Can't locate API module structure `auth_mysql_module' in file E:/Apache2/modules /mod_auth_mysql.so: No error 2、在SVN的认证区,修改如下:
<Location /svn> DAV svn #SVNListParentPath on SVNParentPath e:/svn
AuthzSVNAccessFile e:/ca/access/file
#try anonymous access first,resort to real
#authentication if necessary.
#Satisfy Any
Require valid-user #所有错作需要认证
#how to authenticate a user
AuthType Basic
AuthName "Check ID:" #弹出认证窗口的描述字符串
AuthUserFile e:/ca/access/svn-auth-file
AuthMySQLHost localhost #这里直接借用Bugfree的用户验证表 AuthMySQLUser Bugfree #mysql的用户,必须要有操作密码表的权限 AuthMySQLPassword XXXX #该用户的密码 AuthMySQLDB BugFree #保存用户密码的数据库名字 AuthMySQLUserTable BugUser #保存用户密码的表格 AuthMySQLNameField UserName AuthMySQLPasswordField UserPassword
AuthMySQLMD5Passwords On #新的版本已经不支持这种用法,而使用下面一种用法
AuthMySQLPwEncryption md5 #none | crypt | scrambled | md5 | aes | sha1