Apache and Virtual Hosts Problem on OS X

Posted by Charles Chadwick on Server Fault See other posts from Server Fault or by Charles Chadwick
Published on 2010-12-26T05:22:56Z Indexed on 2010/12/26 5:55 UTC
Read the original article Hit count: 286

Filed under:
|
|
|

I recently formatted and installed my iMac. I am running 10.6.5. Prior to this format, I had the default Apache web server up and running with several virtual hosts, and everything ran beautifully. After formatting, I set everything back up again, and now Apache is acting funny. Here is a description of what I have going on.

My default root directory for the Apache Web server is pointed to an external hard drive. In my httpd.conf, here is what I have:

DocumentRoot "/Storage/Sites"

Then a few lines beneath that:

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

And then beneath that:

<Directory "/Storage/Sites">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from All
</Directory>

At the end of this file, I have commented out the user dir include conf file:

Include /private/etc/apache2/extra/httpd-userdir.conf

And uncommented the virtual hosts conf file:

Include /private/etc/apache2/extra/httpd-vhosts.conf

Moving on, I have the following entry in my vhosts file:

<VirtualHost *:80>
   DocumentRoot "/Storage/Sites/mysite"
   ServerName mysite.dev
</VirtualHost>

I also have a host record in my /etc/hosts file that points mysite.dev to 127.0.0.1 (I also tried using my router IP, 192.168.1.2).

The problem I am coming across is, despite having PHP files in /Storage/Sites/mysite, the server is still looking at /Storage/Sites. I know this because in the DocumentRoot contains a php file with phpinfo() (whereas the index.php file in mysite has different code).

I have tried setting up other virtual hosts, but they are still doing the same thing. Also, "NameVirtualHost *:80" is in my vhosts file. I saw as a solution on another thread here. Doesn't seem to make a difference.

Any ideas on this? Let me know if this is not enough information.

© Server Fault or respective owner

Related posts about apache

Related posts about macosx