Apache 2.2 on Windows Server multiple sites one IP

I’m fairly familiar with the workings of apache on Linux.

Enviroment: Hosted VPS (full access)

Windows Server 2003 Datacentre x64 edition, Apache 2.2

I have 2 straight forward websites I want to host.

example1.com and example2.org

This server was originally set up by someone else and example1.com works as expected.

So my task is to add example2.org to the server.

I create a basic index.html test page in C:\www\example2

add a virtual host record to httpd-vhosts.conf

and for test purposes add a 127.0.0.1 example2.org to my hosts file so I can test locally.

This all worked as expected and I can view example2.org which shows my test html file.

The problem is… when the DNS propagated it shows the example1.com site when I go to example2.org from anywhere but the local windows server.

I’m completely baffled as to why this is happening? Any ideas?

At what point does apache read in outside connections differently to local ones?

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.example2.org
ServerAlias example2.org
ServerAdmin info@example2.org
DocumentRoot “C:/www/example2”

<Directory “C:/www/example2”>
Order Deny,Allow
Allow from all
</Directory>

ErrorLog “logs/example2-error.log”
CustomLog “logs/example2-access.log” common
</VirtualHost>

<VirtualHost *:80>

ServerName www.example1.com
ServerAlias www.example1.com
ServerAdmin info@example1.com
DocumentRoot “C:/www/example1”

<Directory “C:/www/example1”>
Order Deny,Allow
Allow from all
</Directory>

ErrorLog “logs/example1-error.log”
CustomLog “logs/example1-access.log” common
</VirtualHost>
Above is what I have in my httpd-vhosts.conf file… bare in mind example1.com works fine.

do,

Did you update your hosts file with the IP address for the WAN? Yes, 127.0.0.1 is fine for viewing by localhost but NOT from the LAN (192.168.x.x) or WAN (123.321.x.x). On a production machine, that would be taken care of by your control panel which would modify your DNS A record on the server (your hosts file is mimicking that).

Regards,

DK