I've been running Windows Server 2008 very happily on my server for two months now, but only for one domain. Now that I have two sites to host I would like to set up virtual hosts.

I've remove the hash before "mod_simple_vhost" and this is what I've added for those three lines further down the config:

simple-vhost.server-root   = "C:\Program Files (x86)\LightTPD\htdocs\"
simple-vhost.default-host  = "cranktrain.com"
simple-vhost.document-root = "\"

And that path, when appended all together, certainly exists.

Upon a save and then a service restart however, I can't connect. The error/access log shows nothing.

Full config pasted here: http://paste.pocoo.org/show/TcWlMCPZXdpKtucVZXls/

Thank you!

  • You said "I can't connect". What is the error that you are getting? – Khaled Oct 31 '10 at 15:16
  • "The connection has timed out" error in Firefox. – DizzyDoo Oct 31 '10 at 15:19

It might be a bad way of doing it.... but I have always used the steps discribed at: http://www.cyberciti.biz/tips/howto-lighttpd-web-server-setting-up-virtual-hosting.html

In your case, I would add:

$HTTP["host"] =~ "(^|\.)cranktrain\.com$" {
server.document-root = "C:\Program Files (x86)\LightTPD\htdocs\cranktrain.com"
server.errorlog = "C:\Program Files (x86)\LightTPD\logs\cranktrain.com\error.log"
accesslog.filename = "C:\Program Files (x86)\LightTPD\logs\cranktrain.com\access.log"

to the end of my lighttpd.conf file.

  • I commented out the four virtual host lines and paste that at the bottom, save and restart the service but no luck. Same error. – DizzyDoo Oct 31 '10 at 15:36
  • Hmm... I know this sounds obvious, but you do have an A Record set for your domain which points to the IP of your server, don't you? – Joseph Redfern Oct 31 '10 at 15:48
$HTTP["host"] =~ "www\.cranktrain\.com$" {
server.document-root = "C:\Program Files (x86)\LightTPD\HTDOCS/"

Disable simple-vhost and try that. If it works just go on with the link from Joseph: http://www.cyberciti.biz/tips/howto-lighttpd-web-server-setting-up-virtual-hosting.html You have to adapt the paths and so on...

  • This works. Can anyone explain why this works and the one Joseph posted did not? I'm not too hot on Regular Expressions. – DizzyDoo Oct 31 '10 at 16:16
  • My mistake. It works, but it doesn't map to the cranktrain.com directory. I did add cranktrain.com/ after the HTDOCS directory! It seems though, that it still goes to the server.document-root at the beginning of the config. Should that be commented out? (After doing so, it doesn't work.) Should I have simple-vhost enabled? – DizzyDoo Oct 31 '10 at 16:26
  • No you don't need to comment out the "main" server.document-root, for example if you connect to your webserver with the IP in the URL you will get the content of this path (the "default" one). If you connect with your domain then you will get the content from the document-root you set in the vhost config. I dont't know where your cranktrain directory is, but if it is in HTDOCS then the path should be server.document-root = "C:\Program Files (x86)\LightTPD\HTDOCS\cranktrain.com/" – zaub3r3r Oct 31 '10 at 17:45
  • Btw. you don't need that simple-vhost stuff, i've never used that... With the regex in the config-snippet you can only reach your site at www.cranktrain.com. – zaub3r3r Oct 31 '10 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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