Installed four web sites on my personal machine. WinXP SP2 computer with xampp. Followed your instructions above and it works great.
However I'd like to point out that I had shit loads of problems before being successful. I'll try and relate these so that maybe others following in my path wont have so much trouble. Originally I used the installer download but apache was flaky starting. Most of the time I got errors in my event viewer...here is some of them for the clever people to ponder over.
The Apache service named reported the following error:
>>> no listening sockets available, shutting down
The Apache service named reported the following error:
>>> (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80
The Apache service named reported the following error:
>>> apache.exe: Could not open configuration file C:/WebServer/xampp/apache/conf/httpd.conf: The system cannot find the file specified.
BTW, the file was there too!!!
The Apache service named reported the following error:
>>> Unable to open logs
I had edited the httpd.conf as suggested in one of the tutorial on vhost.
Find:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
and replace it with:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
Save and Exit
Also had editing the httpd-vhosts.conf as below with no luck.
This is what we will be deleting:
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin
webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
Once you have done that replace the following code with:
<VirtualHost *:80>
DocumentRoot /xampp/xampp/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /srv/www/yourdomain1
ServerName localhost.main.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /srv/www/yourdomain2
ServerName localhost.main.com
</VirtualHost>
I uninstalled and reinstalled many times, sometimes apache would work for awhile and other times not at all. Only once did I edit the httpd.conf so I don't think it was the only reason why I was having trouble. Biggest problem I had was apache failing to start. I think this was mostly due to port 80 access denied. I had disabled my firewall, microsoft's firewall is disabled by default and also made sure that Microsoft's Internet Information Services was not installed. Made sure before I uninstalled that all xampp processes in task manager was shut down.
Finally after giving up read an articule that said to use the 7-zip executable download. Worked far better, this download doesn't put anything into windows registry. Had to manually start xampp control panel appication and changed the settings to have apache start as a service. But I can start and stop apache every time successfully now.
So a big thankyou to Izzy for the code above that works fine when copied into httpd-vhosts.conf. I didn't need to edit httpd.conf.
Another point to mention, I had installed the installer download only the day before on a schools web server running WinXP SP2 and it worked fine. They are running only the one web site so didn't need to edit httpd-vhosts.conf file.