Virtual hosting in lighttpd

hostinglighttpdvirtualization

Ok, here it goes… I've seen some other posts dealing with this, but it didn't help that much. I am using Windows XP. My problem is with trying to get lighttpd working with virtual hosts. Now, I managed to get everything up and working with the default /htdocs and the default page shows up just fine on the internet, but since I have several sites to host, I need virtual hosting. I managed to do it in apache, so I guessed it would work out just fine in lighttpd, but apparently I'm missing something.

Ok, let's say I have domain (www.)example.org. I want everyone using that url going to the correct index.html, obviously. Let's say that index.html is in directory websites/website1 placed under the lighttpd dir. (thus, the full path is c:/ProgramsFiles/lighttpd/websites/website1/index.html)

Now: How, exactly, do I set up my virtual host (in the config file)? In detail, please, since I've tried for hours with the vague hints I got from fora and such, but it doesn't work.

Also is there something additional to do? Change the server.bind or get rid of the default server.document-root, or something?

I appreciate all the help you can give! Especially if it's a verbatim/step-by-step solution you're offering!

Edit: And, yes, my mod_simple_vhost has been enabled.

Best Answer

All you'll need is a config like this:

$HTTP["host"] =~ "(^|www\.)example\.org$" {
    server.document-root = "C:/Program Files/lighttpd/websites/website1/" 
}

Not quite sure how the path needs to be formatted under Windows - maybe escape the space in Program Files?

You don't need mod_simple_vhost unless you're looking to have dynamically configured vhosts based on the domain name.

Related Topic