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 *:80>
  DocumentRoot "/Users/achan/Sites/pxproj"
  ServerName pxproj

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)


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

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.