MacOS – Apache virtualhost – Mac OSX 10.7.3

apachemacos

After upgrading to Lion, all my virtualhosts stopped working. They redirect to "It works" main apache page on my device for some weird reason.

Example:

/etc/hosts:
127.0.0.1 myhost.com

<VirtualHost *:80>
    DocumentRoot "/Library/WebServer/Documents/testproj/"
    ServerName myhost.com

    <Directory "/Library/WebServer/Documents/testproj/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog "/private/var/log/apache2/testproj-error_log"
    CustomLog "/private/var/log/apache2/testproj-access_log" common
</VirtualHost>

Did anyone else face the same issue? How can I fix this?

Best Answer

There could be multiple causes to this issue.

First, have you tried restarting Apache?
You can do so by typing sudo apachectl graceful in the Terminal.

If that doesn't work out, try to create a folder in the predestined folder (Sites), and see if it works. Alsoo, make sure you've enabled the proper settings: enter image description here

And just for the record, my httpd-vhosts.conf file (on a Windows though) looks like this:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName dev.test.be
    ErrorLog "logs/test.log"
    CustomLog "logs/test.log" common
    DocumentRoot "C:\Users\me\workspace\test\drupal"
</VirtualHost>