Apache2和mysql授权

Apache2和mysql授权,mysql,apache2,authorization,Mysql,Apache2,Authorization,我正在尝试使用MySQL在Ubuntu 14.04上的apache2上设置授权 .htaccess: AuthName "restricted area" AuthType Basic AuthBasicAuthoritative Off AuthUserFile /dev/null AuthMySQL On AuthMySQL_Authoritative on AuthMySQL_Host 10.30.200.1 AuthMySQL_Username name AuthMySQL_Passw

我正在尝试使用MySQL在Ubuntu 14.04上的apache2上设置授权

.htaccess:

AuthName "restricted area"
AuthType Basic
AuthBasicAuthoritative Off
AuthUserFile /dev/null

AuthMySQL On
AuthMySQL_Authoritative on
AuthMySQL_Host 10.30.200.1
AuthMySQL_Username name
AuthMySQL_Password pass
AuthMySQL_DB db
AuthMySQL_Password_Table access
AuthMySQL_Username_Field user
AuthMySQL_Password_Field password
AuthMySQL_Encryption_Types PHP_MD5
AuthMySQL_Empty_Passwords Off

Require valid-user
如果凭证正确,我将收到401错误和error.log中的“[:error][pid 1763]No requires line available”。否则——只有401


我做错了什么?

错误消息来自mod auth mysql模块本身。 我下载了源代码并查看了mod_auth_mysql.c文件

通过文件末尾附近的函数mysql\u check\u auth(),您可以找到:

    if (!reqs_arr) {
    if (sec->authoritative) {
        APACHELOG(APLOG_ERR, r, "No requires line available");
        return HTTP_UNAUTHORIZED;
    } else {
        return DECLINED;
    }
}
经过一些研究,我发现了这个网站和以下补丁:

但是ubuntu/debian模块是基于2.2.0版而不是3.0.0版的。 另外,部分修补程序已经包括在内:
mod-auth-mysql_4.3.9-13.1ubuntu3.diff.gz

//编辑
首先,必须将AuthMySQL\u authoritive设置为Off,以便处理用户所需的mod\u authz\u,如有效用户。

如果您想通过mod auth mysql检查组,一个简单的修复程序是移动AuthMySQL\u中的用户和组要求,因为ap\u requires不再存在,补丁程序将其设置为Null:

require group g1 g2
这就变成了:

AuthMySQL_Where "AND user_group IN ('g1', 'g2')"

在相同的版本上有完全相同的问题

.htaccess
上设置以下选项,为我实现了以下目的:
关闭AuthMySQL\u authoritional

无需任何补丁关闭AuthMySQL\u authoritional并执行AuthMySQL\u即可完全解决问题。

这里的相同问题,如果我设法找到解决方案,我会报告它在apache2.4和Ubuntu14.04上对我有效