IP-Based Virtual Hosts Lighttpd

hostslighttpdvirtualization

I have multiple IP's and I would like to route each one to its own directory.

This is what I have so far..

$SERVER["socket"] == "XXX.XXX.XXX.XXX:81" {
  server.document-root = "/var/www/XXX.XXX.XXX.XXX "
}

While this works, It only works on port 81 and not the default 80.

When I change the port to 80, lighttpd fails to start up with the following error messege.

(network.c.300) can't bind to port: XXX.XXX.XXX.XXX 80 Address already in use

Please help!

Best Answer

What I did was:

server.bind = "127.0.0.1"

then

$SERVER["socket"] == "IP1:80" {
}

$SERVER["socket"] == "IP2:80" {
}
Related Topic