Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
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

2 Answers 2

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.

share|improve this answer
    
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...

share|improve this answer
    
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

 
discard

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.