Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.) 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.

share|improve this question
Maybe you can include what you configurations look like at the moment? – Lucas Kauffman Mar 31 '12 at 13:50

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.

share|improve this answer
Yep, that did it! Thanks a lot! I'm not sure why it isn't mentioned anywhere in the ## explanation in the config file like that. I don't think I would have ever found it, with the $HTTP["host"] =~ "(^|www\.)example\.org$" { -thingy; I just kept trying it the way it was indicated in the ##part of the configfile. Must have tried dozens of variants, to no avail. But anyway, this worked like a charm! Thnks again! – lighttpdnewbie Mar 30 '12 at 22:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.