linux - Lighttpd认证

标签 linux lighttpd

我有一台安装了 Lighttpd (1.4.28) 的 Linux 服务器。现在我已经为多个文件夹 (13) 设置了身份验证,如下所示:

auth.debug = 2
auth.backend = "plain"
auth.backend.plain.userfile = "/home/.lighttpdpasswd"
auth.require = (

"/test1" =>
            (
            "method" => "basic",
            "realm" => "Password protected area",
            "require" => "user=test1"
            ),
.
.
.

"/test13" =>
            (
            "method" => "basic",
            "realm" => "Password protected area",
            "require" => "user=test13"
            ),
)

lighttpdpasswd 是这样的:

test1:test1
test2:test2
test3:test3
test4:test4
test5:test5
test6:test6
test7:test7
test8:test8
test9:test9
test10:test10
test11:test11
test12:test12
test13:test13

现在,对于 1 到 9 的文件夹,身份验证效果很好,对于 10,11,..13,使用正确的凭据拒绝访问!

这是 lighttpd 的错误还是我应该添加一些参数?

最佳答案

lighttpd mod_auth 在遍历 auth.require 列表时进行简单的前缀匹配。它不寻找完整的路径匹配,只寻找前缀匹配。

解决方法是在 auth.require 列表中将较长的路径放在较短的路径之前,因此“test10”和“test11”在“test1”之前

关于linux - Lighttpd认证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36568738/

相关文章:

python - 在 lighttpd 和 raspberry pi 上部署 Flask

nginx - 启动临时 docker 实例 : Is it recommended to launch a docker instance per request?

linux - 如何使用 linux 字符串操作从 html 文档中提取天气数据

php - codeigniter 无法在 Linux 上运行

安卓java.net.SocketException : socket failed: EACCES (Permission denied)

linux - cgroups 和命名空间的区别

linux - 根据参数将 bash 中的命令替换为其他命令

php - 如何在lighttpd 中执行mysqldump?使用 PHP

php - lighttpd 上的 web2py 和 wordpress

python - 如何运行 python 脚本?