Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

Only include directive options that will be common to all VirtualHosts in your main httpd.conf file. Make all hosts served by Apache virtual.

Remove the DocumentRoot and blocks from your main httpd.conf file. Only have them in the httpd-vhosts.conf file.

share|improve this answer
    
That didn't seem to work. I ran "sudo httpd" and this error was given: (48)Address already in use: make_sock: could not bind to address [::]:80 –  Charles Chadwick Dec 26 '10 at 18:27
1  
Apache is already running. Execute 'sudo apachectl graceful' or disable and re-enable the service under Sharing in the System Preferences. –  bahamat Dec 27 '10 at 8:19
add comment

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.