Setting up Multiple Virtual Hosts in XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Setting up Multiple Virtual Hosts in XAMPP

Postby FeralReason » 03. April 2010 18:15

I am working in a localhost development environment and am attempting to set up Virtual Hosts for managing projects.
(I am an Apache novice.)

I successfully set one up some time ago but cannot seem to set up a second.
The first one is called "kitchen", pointing to a folder called "kitchendocs". This works fine.
The second is called "bluevista", pointing to a folder called "loreen". This does not work at all.

The relevant code from my httpd-vhosts.conf file is shown below. Can anyone see what I am doing wrong ?

Thanx, Glenn
Code: Select all
   ...
   <Directory "C:/xampp/feralpots/kitchendocs">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All

    Order allow,deny
    Allow from all

</Directory>

<Directory "C:/xampp/feralpots/loreen">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All

    Order allow,deny
    Allow from all

</Directory>

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot C:/xampp/feralpots/httpdocs   
  ServerName localhost
  ErrorLog C:/xampp/apache/logs/localhost-error_log
  CustomLog C:/xampp/apache/logs/localhost-access_log common
</VirtualHost>

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot C:/xampp/feralpots/kitchendocs   
  ServerName kitchen
  ErrorLog C:/xampp/apache/logs/kitchen-error_log
  CustomLog C:/xampp/apache/logs/kitchen-access_log common
</VirtualHost>

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot C:/xampp/feralpots/loreen   
  ServerName bluevista
  ErrorLog C:/xampp/apache/logs/loreen-error_log
  CustomLog C:/xampp/apache/logs/loreen-access_log common
</VirtualHost>
FeralReason
 
Posts: 19
Joined: 16. April 2009 20:42

Re: Setting up Multiple Virtual Hosts in XAMPP

Postby FeralReason » 03. April 2010 22:57

Solved it. For the benefit of anyone else interested:

I had forgotten that Windows also requires changes in a "hosts" file. In my XP system this is at C:\WINDOWS\system32\drivers\etc\hosts.

For example, if you are setting up two virtual hosts ("kitchen" and "bluevista") you need to have lines in your hosts file similar to the following:

Code: Select all
127.0.0.1  localhost
127.0.0.1   kitchen
127.0.0.1   bluevista
FeralReason
 
Posts: 19
Joined: 16. April 2009 20:42


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 171 guests