是否有一种方便的方法来密码保护符合Lighttpd中某种模式的网址?
我考虑过匹配正则表达式,但任何其他创意解决方案都会很好。
注意:我不是在寻找一种密码保护目录的方法,因为我想要保护的URL并不局限于某个目录结构。
亚当
答案 0 :(得分:6)
你看过mod_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"
)
auth文件将包含(用于基本身份验证):
username:password
更多信息:http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModAuth
过滤/检查特定目录,
$HTTP["url"] =~ "^/download(s)?$" {
auth.require = ( "" =>
(
"method" => "basic",
"realm" => "Passworded Area",
"require" => "user=username"
)
)
}