Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lighttpd:如何对匹配正则表达式的URL进行密码保护_Url_Lighttpd_Password Protection - Fatal编程技术网

Lighttpd:如何对匹配正则表达式的URL进行密码保护

Lighttpd:如何对匹配正则表达式的URL进行密码保护,url,lighttpd,password-protection,Url,Lighttpd,Password Protection,有没有一种方便的方法来对符合特定模式的URL进行密码保护 我考虑过匹配正则表达式,但任何其他创造性的解决方案都会很好 注意:我不是在寻找一种对目录进行密码保护的方法,因为我想要保护的URL并不局限于某个目录结构 Adam你看过mod\u auth插件了吗 auth.debug = 0 auth.backend = "plain" auth.backend.plain.userfile = "/full/path/to/auth-file.txt" auth.require = ("example

有没有一种方便的方法来对符合特定模式的URL进行密码保护

我考虑过匹配正则表达式,但任何其他创造性的解决方案都会很好

注意:我不是在寻找一种对目录进行密码保护的方法,因为我想要保护的URL并不局限于某个目录结构


Adam

你看过
mod\u auth
插件了吗

auth.debug = 0
auth.backend = "plain"
auth.backend.plain.userfile = "/full/path/to/auth-file.txt"
auth.require = ("example.com" =>
(
"method" => "basic",
"realm" => "Password protected area",
"require" => "user=username"
)
身份验证文件将包含(对于基本身份验证):

更多信息:

要筛选/检查特定目录

$HTTP["url"] =~ "^/download(s)?$" {
    auth.require = ( "" =>
        (
            "method"  => "basic",
            "realm"   => "Passworded Area",
            "require" => "user=username" 
        )
    )
}

我添加了一个带有正则表达式的示例。谢谢!这会让我走的。
$HTTP["url"] =~ "^/download(s)?$" {
    auth.require = ( "" =>
        (
            "method"  => "basic",
            "realm"   => "Passworded Area",
            "require" => "user=username" 
        )
    )
}