0

I'm using Xampp (Apace 2.2.20) on mac os lion for development. I have a number of CMS projects and i want to access them by going to cms1.localhost, cms2.localhost, cms3.localhost etc

Currently, with the setup I have below, all requests to the server are resolved by whichever virtual host i put first in the configuration, ie currently (/Applications/XAMPP/migration/trunk).

Can anyone please point me in the right direction please. I can't think what else to do in terms of debug etc so that help would be useful too. Thanks a lot.

<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/migration/trunk"
</Virtualhost>

<VirtualHost *:80>
ServerName rix.localhost
DocumentRoot "/Applications/XAMPP/projects/giving"
</Virtualhost>

In /etc/hosts I have:

127.0.0.1 localhost
127.0.0.1 rix.localhost
1
  • First, get rid of the tld's, eg. Make the second one just "rix" in both configs... test it like that.
    – Soviero
    Dec 1, 2011 at 8:27

1 Answer 1

1

Assuming that you've tried swapping around the two VirtualHost blocks and you get the corresponding site loading on localhost and rix.localhost, you're probably missing the NameVirtualHost *:80 directive.

Have a look in your Apache configs for that. If it's not there anywhere, add it somewhere in the main configuration area (ie, not in a VirtualHost block).

I like to set up logging each VirtualHost, so use ErrorLog and CustomLog Apache directives in each VirtualHost section. There's probably corresponding lines in the main configuration file too (outside VirtualHost sections), and that can be useful to look at.

When starting apache, errors like overlapping VirtualHosts get logged. I can't tell you where XAMMP would output those errors when it starts, but I would think it would log them somewhere. The XAMMP documentation would be a good start for that.

1
  • Thanks so much, that's exatly what it was - missing NameVirtualHost *:80. Thanks again..
    – rix
    Dec 1, 2011 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .