4

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?

9

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

They should both be

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.