PDA

View Full Version : Using evhost with Lighttpd


GJay
09-20-2006, 10:19 PM
I want to setup lighty so that subdomains are mapped automatically to directories, i.e. http://test.localhost will go to /var/www/test; http://foo.localhost will go to /var/www/foo etc.
All the documentation I've found suggests this is trivial, but I just can't get it to work.
The server is starting fine, going to http://localhost loads /var/www/index.php as it should, but any subdomains I've added to /etc/hosts just load the same page.
I have in hosts:

127.0.0.1 localhost test.localhost

and /var/www/test/index.html exists, but /var/www/index.php gets loaded when I go to http://test.localhost.
Where am I going wrong?
(config, minus comments, below)


server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_fastcgi",
"mod_evhost"
)

server.document-root = "/var/www/"

server.errorlog = "/var/log/lighttpd/error.log"

index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm" )
accesslog.filename = "/var/log/lighttpd/access.log"

url.access-deny = ( "~", ".inc" )

server.pid-file = "/var/run/lighttpd.pid"

dir-listing.encoding = "utf-8"
server.dir-listing = "enable"

server.username = "www-data"

server.groupname = "www-data"


evhost.path-pattern = "/var/www/%0"

## this is a hack
alias.url = ("___invalid___" => "___invalid___")

fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php.socket"
)))