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


/etc/hosts: 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

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

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


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"
  • Tried all... nothing happened. The virtualhost configs are unchanged since the upgrade and they used to be working quite fine – Maverick Apr 2 '12 at 15:57

Where is that snippet of VirtualHost config? Are you sure it's being read in?

I notice that by default, the /etc/apache2/extra/httpd-vhosts.conf file is not read in by the main httpd.conf so you'd have to uncomment the line to read it in.

You can check what Apache thinks of the current vhost config with

sudo httpd -S

and verify that your myhost.com is there.

Please update your question with the results of this if it's not the problem so we can start narrowing it down.

You must log in to answer this question.

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