server.modules = (
 "mod_alias",
 "mod_redirect",
 "mod_cgi"
)

server.document-root =  "/www/htdocs"
server.upload-dirs =  ( "/www/tmp" )
server.errorlog =       "/www/log/error.log"
server.pid-file =       "/var/run/lighttpd.pid"
server.username =       "httpd"
server.groupname =      "nogroup"
server.port =           80

index-file.names = (
    "index.html",
    "default.html"
)

$SERVER["socket"] == ":80" {
    $HTTP["host"] =~ "(.*)" {
        url.redirect = ( "^(?!/systemupdate|/resources).*$" => "http://%1/systemupdate" )
    }
}

cgi.assign = (
    ".sh"   =>  "/bin/bash",
    ".cgi"  =>  "",
)

#url.access-deny = ( "~", ".inc", ".htaccess", ".htpasswd", "htpasswd", "/tmp/" )

$HTTP["request-method"] == "GET" {
  alias.url = (
    "/resources"  =>  "/opt/lib/resources",
    "/systemupdate"      =>  "/opt/lib/cgi/rescue.cgi",
  )
}

$HTTP["request-method"] == "POST" {
  alias.url = (
    "/systemupdate"      =>  "/opt/lib/cgi/rescue.cgi",
  )
}

## reads optional conf files
include "/etc/lighttpd/mime.conf"
