On my WAMP local Host I am running two different social engine websites, in my hosts file I added two lines:

127.0.0.1 site1.com

127.0.0.1 site2.com

in my apache.conf file I have added this code for virtual hosting

<VirtualHost 127.0.0.1>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /wamp/www/se3
    ServerName site1.com
    ServerAlias site1.com
    ErrorLog logs/site1-error_log
    CustomLog logs/site1-access_log common
</VirtualHost>
<VirtualHost 127.0.0.1>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /wamp/www/site2
    ServerName site2.com
    ServerAlias site2.com
    ErrorLog logs/site2-error_log
    CustomLog logs/site2-access_log common
</VirtualHost>

Now the problem which I am facing is, when on browser when I type site1.com it loads site1 correctly, but when I type site2.com it loads site1.

I can't find out the actual problem behind this.

Can any one help me out?

:)

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

Have you got name based virtual hosting enabled with a NameVirtualHost directive somewhere?

eg: NameVirtualHost 127.0.0.1

link|improve this answer
in httpd.conf file their is no where written such line, should I add it? – ntechi Apr 7 '11 at 13:34
Yes, otherwise Apache will default to IP based virtual hosting where each virtual host will need to be on a separate IP address. – James Yale Apr 7 '11 at 13:39
feedback

Your Answer

 
or
required, but never shown

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