I'm trying to convince my Apache to point localhost to /Sites. What am I doing wrong?

httpd.conf settings

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

<VirtualHost *>
    DocumentRoot "/Users/username/Sites"
    ServerName localhost
  • DocumentRoot points to /Sites folder.
  • Listen 80
  • NameVirtualHost *

Buggy Result

  1. results with /Sites folder.
  2. does the same.
  3. ERROR: http://localhost results with /private/etc/apache2/.../htdocs

3 Answers 3


I'm writing this shamefully, just for one reason: I found a thread with that question exactly, that ended with the user asking the questions saying "Got it working. Too ashamed to say what was the problem".

I nearly killed myself.

listen localhost:80

That's what I've been missing the whole time. There, for future generations. Amen.

  • At least I got a glimpse inside Apache's famous gut configuration. Gotta look on the bright side of bugs.
    – konzepz
    Sep 30, 2009 at 20:27

What does localhost resolve to? It could legitimately be the IPv6 ::1, or anything in

  • I have both of these (::1 localhost / localhost) in .hosts file.
    – konzepz
    Sep 30, 2009 at 19:28

Without more info, I can't say exactly why this is happening. Apache is sensitive to the order in which virtual hosts are specified in its configuration. However, I'd use here. Unless you want other name-based virtual hosts on

Also, it may be useful for you to use the following command to see what Apache thinks of your virtual host configuration:

apache2 -t -D DUMP_VHOSTS

Depending on your particular system, the "apache2" command may be something else, like "httpd". If you're running Windows, I don't know if it will work at all.

  • DUMP_HOSTS gives: : is a NameVirtualHost | default server localhost (/private/etc/apache2/extra/httpd-vhosts.conf:36) | port * namevhost localhost (/private/etc/apache2/extra/httpd-vhosts.conf:36). Looks okay. The httpd-vhosts.conf is set as I mentioned in the question. What to do now?
    – konzepz
    Sep 30, 2009 at 20:21

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.