I'm learning lighttpd from a book, and it seems like I am dealing with a variable scoping issue, which doesn't quite makes sense to me. My default lighttpd.conf for gentoo defines:
Code:
var.basedir = "/var/www/localhost"
This variable is, of course, used several ways later on. I want to change it to this:
Code:
var.basedir = "/var/www/localhost
$HTTP["host"] == "other.domain.com" {
var.basedir = "/var/www/other-domain-com"
}
But it doesn't work. basedir seems to stay with the default value ("/var/www/localhost") regardless of the hostname I use. It is as if the second var.basedir assignment is being restricted to the scope of the brackets. But if I get rid of all my variables and just use server.document-root directly it works fine:
Code:
server.document-root = "/var/www/localhost/htdocs"
$HTTP["host"] == "other.domain.com" {
server.document-root = "/var/www/other-domain-com/htdocs"
}
Why would the server.document-root assignment not be restricted in scope while the var.basedir assignment is? Do I need to declare a variable global somehow?
Code:
# lighttpd -v
lighttpd/1.4.28 (ssl) - a light and fast webserver
Build-Date: Mar 12 2011 14:31:26