Setting up httpd-vhosts.conf for multiple virtual hosts

Posted by Chris Sobolewski on Server Fault See other posts from Server Fault or by Chris Sobolewski
Published on 2011-01-11T03:35:17Z Indexed on 2011/01/11 3:56 UTC
Read the original article Hit count: 287

Filed under:
|
|
|

I have a simple test setup using xampp at home, and I am getting really weird behavior when I attempt to set up multiple virtual hosts on this box. Here is my vhosts file:

 NameVirtualHost *:80
 <VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName foo
  DocumentRoot "D:\wamp\xampp\htdocs\foo"
  ErrorLog logs/foo-error_log
  CustomLog logs/foo-access_log common
    <Directory "D:\wamp\xampp\htdocs\foo">
      Options Indexes FollowSymLinks Includes execCGI
      AllowOverride All
      Order Allow,Deny
      Allow From All
    </Directory>
 </VirtualHost>

 <VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName bar
    DocumentRoot "D:\wamp\xampp\htdocs\bar"
    ErrorLog logs/bar-error_log
    CustomLog logs/bar-access_log common
    <Directory "D:\wamp\xampp\htdocs\bar">
      Options Indexes FollowSymLinks Includes execCGI
      AllowOverride All
      Order Allow,Deny
      Allow From All
    </Directory>
  </VirtualHost>

When I attempt to run visit the first site, it works as expected.

When I attempt to run the second site, I get a weird hybrid mishmash of both sites. It's the weirdest thing.

© Server Fault or respective owner

Related posts about windows-7

Related posts about apache2