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.

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
share|improve this question
    
First, get rid of the tld's, eg. Make the second one just "rix" in both configs... test it like that. –  Kevin Soviero Dec 1 '11 at 8:27
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks so much, that's exatly what it was - missing NameVirtualHost *:80. Thanks again.. –  rix Dec 1 '11 at 9:34
add comment

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.