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.

Here's the problem I'm facing: I've added multiple virtual hosts(name based) to apache yet still only one is loaded.

For example I have two domains with different contents.

Site1 Domain -> Site1 Content
Site2 Domain -> Site1 Content aswell..

I've included the httpd-vhosts file in the httpd config file, and I've edited it to match what it asks me to do on their documentation yet still only one folder of contents is served.

Here is my httpd-vhosts file, the httpd file I assume doesn't need posting but if required I shall:

NameVirtualHost *
<Directory "C:/www/">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

</Directory>
<VirtualHost *>
    ServerName www.*****.com
    DocumentRoot "C:\www*****"
</VirtualHost>

<VirtualHost *>
    ServerName ****.co.cc
    DocumentRoot "C:\www\****"
</VirtualHost>

ofcourse I removed the unnecessary comments and my domains names(private reasons). Oh yeah, and my server is hosted on Windows Server 2008 Standard

share|improve this question

3 Answers 3

First off, can you check the log files for errors when you start up Apache? It might be complaining, and it will give very useful information if it does..

Secondly, are you making similar changes to the SSL side of things? MOD_SSL is handled via a different config file, and if you're trying to access these sides of things on port 443, you're not going to get all the different sites working.


share|improve this answer

On the surface of it, your config seems fine. How are you accessing these site? Are you including the Virtual Hosts config at the bottom of httpd.conf?

share|improve this answer

For example I have two domains with different contents.

Site1 Domain -> Site1 Content Site2 Domain -> Site1 Content aswell..

So which is it? Different content or the same content for both domains?

If its the same content then the correct way is to use the serveralias option:

<VirtualHost *>
    ServerName www.firstdomain.com
serveralias firstdomain.com www.seconddomain.com seconddomain.com
    DocumentRoot "C:\www*****"
</VirtualHost>

Now you can serve the same content in the manner YOU were trying to do as well. You just have to set the correct document root for domain number 2. In your example the doc root contains a backslash that it shouldn't if the idea is to serve the same content as domain 1.

share|improve this answer

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.