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.

When I enable my vhosts file (i.e. uncomment this line: Include /private/etc/apache2/extra/httpd-vhosts.conf) I am unable to reach localhost. I /am/ able to reach the last virtual host listed in my vhosts file:

<VirtualHost *:80>
  DocumentRoot "/Users/achan/Sites/epwbst"
  ServerName epwbst                                                                                                  
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "/Users/achan/Sites/pxproj"
  ServerName pxproj
</VirtualHost>

Typing pxproj in my browser brings up the expected web content. But I am unable to reach epwbst or localhost. If I re-comment the vhost line in my httpd.conf, I am able to reach local host (i.e. "It works!") but obviously am unable to reach my virtual hosts. I don't know how to continue troubleshooting this.

Why can't I reach localhost when I've got my vhosts turned on?

OS: Mac OS X 10.7

Server version: Apache/2.2.21 (Unix)

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Once you turn on vhosts, you must add localhost as a vhost. See my answer here: Virtual host “Forbidden You don't have permission to access / on this server” on debian

share|improve this answer
    
Thanks; I wonder if this is something new because in my previous encounters with apache I don't remember doing this. –  Avery Chan Jun 11 '12 at 5:23
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.