目录指令:AuthType 无但仍需要 AuthProvider?

Ste*_*ler 3 debian authentication apache-2.2

我使用的是 Apache 2.2 而不是 2.4,这解释了标题中的错误。Brain99发表评论后,我发现我有2.2,将我的配置调整为他建议的(仍然不起作用),尝试了一下,睡了一晚,第二天我发现,我忘记了包含启用 mod 的目录的语句!

现在我只需要服务器让我从一个特定的文件夹下载文件(在我的情况下,我为该任务选择了 /opt/myFolder)

发行版是 Debian 6.0

编辑开始

Apache 版本是 2.4,根据他们的官方文档,不推荐使用 Order/Allow 子句,不应再使用

我是个白痴:Apache 版本是 2.2。

edit_end 我在 apache2.conf 中的目录指令如下所示:

<IfModule dir_module>
                DirectoryIndex index.html index.htm index.php
</IfModule>
ServerRoot "/etc/apache2"
DocumentRoot "/opt/myFolder"
<Directory />
        Options FollowSymLinks
        AuthType None
        AllowOverride None
        Require all denie
</Directory>
<Directory "/opt/myFolder/*">
        Options FollowSymLinks MultiViews
        AllowOverride None
        AuthType None
        Require all allow
</Directory>
Run Code Online (Sandbox Code Playgroud)

当我尝试访问该文件夹中的文件 ( http://myserver.de/aTestFile.zip ) 时,出现内部服务器错误。Apache 还将以下错误写入其日志:

configuration error:  couldn't check user.  Check your authn provider!: /aTestFile.zip
Run Code Online (Sandbox Code Playgroud)

如果我不需要任何身份验证,为什么我需要一个身份验证提供程序?另外我希望有人可以向我解释我需要什么样的 AuthenticationProvider 。每次我搜索这些东西时,都会有人问我如何使用密码保护文件/目录或限制对某些 IP 地址的访问,这对我没有真正的帮助。

好的,因为我有 Apache 2.2 版,这里是我在使用 Order/Deny/Allow 命令而不是 AuthType/Require 时得到的错误:

Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration.
Run Code Online (Sandbox Code Playgroud)

bra*_*n99 6

我相信这是由于以下错误的配置指令:

Require all denie
Require all allow
Run Code Online (Sandbox Code Playgroud)

请尝试以下配置:

<Directory />
        Options FollowSymLinks
        AuthType None
        AllowOverride None
        Order deny,allow
        Deny from all
</Directory>
<Directory "/opt/myFolder/*">
        Options FollowSymLinks MultiViews
        AllowOverride None
        AuthType None
        Order deny,allow
        Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)

编辑 2:您的问题也可能是由于未加载mod_authz_host模块。您可以尝试使用a2enmod authz_host并重新启动 apache来启用它。

此外,似乎AuthType None是无效的。只需AuthType从您的配置中完全删除该指令即可。