尝试在 lighttpd 中设置 webdav 时出现配置错误

尝试在 lighttpd 中设置 webdav 时出现配置错误

我正在尝试在 lighttpd 上设置 webdav,但出现 lighttpd.conf:解析器在文件末尾附近的某个地方失败。webdav 配置位于文件末尾:这里是-

$HTTP["host"] == "www.markmhart.com" {
  server.document-root = "/var/www/servers/www.markmhart.com/pages/" 
  $HTTP["url"] =~ "^/download/" {
    dir-listing.activate = "enable" 
  }
alias.url = ("/media" => "/media/mark/media")
    $HTTP["url"] =~ "^/media($|/)" {
        webdav.activate = "enable"
        webdav.is-readonly = "disable"
        webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
        auth.backend = "htpasswd"
        auth.backend.htpasswd.userfile = "/var/www/servers/www.markmhart.com/passwd.dav"
        auth.require = ( "" => ( "method" => "basic",
            "realm" => "webdav",
            "require" => "valid-user" ))
 
}

在此先感谢您的帮助。

答案1

当您正确缩进配置文件时,您会注意到缺少一个右花括号:

$HTTP["host"] == "www.markmhart.com" {
  server.document-root = "/var/www/servers/www.markmhart.com/pages/" 
  $HTTP["url"] =~ "^/download/" {
    dir-listing.activate = "enable" 
  }
  alias.url = ("/media" => "/media/mark/media")
  $HTTP["url"] =~ "^/media($|/)" {
    webdav.activate = "enable"
    webdav.is-readonly = "disable"
    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
    auth.backend = "htpasswd"
    auth.backend.htpasswd.userfile = "/var/www/servers/www.markmhart.com/passwd.dav"
    auth.require = ( "" => ( "method" => "basic",
        "realm" => "webdav",
        "require" => "valid-user" ))
  }

只需在最后添加它:

}

相关内容