Forum Moderators: phranque

Message Too Old, No Replies

Virtual Hosts on Win32

vhost settings on an XP machine

         

chroma

6:20 pm on May 17, 2006 (gmt 0)

10+ Year Member



Hi, this is probably something that comes up again and again, and I've looked through the searches, and tried some things, but can't get this setup to work.

Basically, I want to setup a server on my local machine, with access only from the same machine, but want to run two or more virtual hosts.

I've installed apache2triad and have the following config...

-----------------------
From httpd.conf

NameVirtualHost local.test:80
NameVirtualHost localhost:80

<VirtualHost local.test:80>
ServerName local.test
DocumentRoot "c:\apache2triad\htdocs\test"
ErrorLog logs/test-error_log
</VirtualHost>

<VirtualHost localhost:80>
ServerName localhost
DocumentRoot "c:\apache2triad\htdocs\localhost"
ErrorLog logs/localhost-error_log
</VirtualHost>

--------------------------------

In HOSTS file:

127.0.0.1 localhost
127.0.0.1 local.test

--------------------------------

apache -S gives this output...

C:\apache2triad\bin>apache -S
[Wed May 17 11:45:35 2006] [error] (OS 11001)No such host is known. : Cannot resolve host name local.test --- ignoring!
[Wed May 17 11:45:35 2006] [error] (OS 11001)No such host is known. : Cannot resolve host name local.test --- ignoring!
VirtualHost configuration:
127.0.0.1:80 is a NameVirtualHost
default server localhost (C:/apache2triad/conf/httpd.conf:1023)
port 80 namevhost localhost (C:/apache2triad/conf/httpd.conf:1023)
Syntax OK

--------------------------

My browser reports that it can't find server for [local.test...] [localhost...] is fine, and works from the defined directory in httpd.conf

I thought it could be a problem with the XP HOSTS setup, but can't work out what. I can't ping local.test, but can ping localhost. I'm stumped - any ideas much appreciated.

Chroma

maccas

7:05 pm on May 17, 2006 (gmt 0)

10+ Year Member



Doesn't answer your question but I have it set up like this on my windows xp machine:

<VirtualHost 127.0.0.1>
DocumentRoot C:/webpages/site1
ServerName 127.0.0.1
</VirtualHost>

<VirtualHost 127.0.0.2>
DocumentRoot C:/webpages/site2
ServerName 127.0.0.2
</VirtualHost>

etc etc

chroma

10:10 pm on May 17, 2006 (gmt 0)

10+ Year Member



looks interesting - does the 127.0.0.2 loopback to the local machine then?

basuraza

1:19 pm on May 18, 2006 (gmt 0)

10+ Year Member



127.0.0.2 doent seems to be a loopback of the machine, so try the trick that puts the path to different address, or try file hosts to define local.test

jdMorgan

2:36 am on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



127.0.0.2 should be a loopback address, but due to a known bug, it doesn't work on XP SP2 without an unpublicized patch. See: Programs that connect to IP addresses that are in the loopback address range may not work as you expect in Windows XP Service Pack 2 [support.microsoft.com]

Jim

chroma

7:32 pm on May 19, 2006 (gmt 0)

10+ Year Member



Thanks very much - that's got it working nicely.