Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In /etc/apache2/extra/httpd-vhosts.conf, I have:

NameVirtualHost *:80

<VirtualHost *.80>
    ServerName localhost
    DocumentRoot "/Library/WebServer/Documents"
</VirtualHost>

<VirtualHost *:80>
    ServerName site1.local
    DocumentRoot "/Users/bob/Sites/site1.local"
    <Directory /Users/bob/Sites/site1.local>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *.80>
    ServerName site2.local
    DocumentRoot "/Users/bob/Sites/site2.local"
    <Directory /Users/bob/Sites/site2.local>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

In /etc/hosts, I have:

127.0.0.1     site1.local
127.0.0.1     site2.local

Browsing to http://site1.local yields the correct site. However, browsing to http://site2.local displays Site1's content.

Did I mis-configure something?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

In both your localhost and site2.local <virtualHost> declarations you have a . (dot) instead of a : (colon).

They should both be

<VirtualHost *:80>
share|improve this answer
    
Good eye :) That was it. –  Bullines Aug 13 '11 at 20:26

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.