Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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>
share|improve this answer
    
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.

share|improve this answer

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.