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

ErrorLog "logs/example2-error.log"
CustomLog "logs/example2-access.log" common

<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

ErrorLog "logs/example1-error.log"
CustomLog "logs/example1-access.log" common

Above is what I have in my httpd-vhosts.conf file.. bare in mind example1.com works fine.

  • SOLVED.. there were more vhosts further down the file that were causing the problem. removed and re-entered correctly and all fine. still think its weird that local connections behave differently to external. – Derek Organ Jul 15 '10 at 11:02

You need to create two different virtual hosts for this sites with different "ServerName xxxxx" option

  • I've added the contents of the file above as you can see i have the ServerName option – Derek Organ Jul 14 '10 at 16:27

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.