Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


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
share|improve this question

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.

share|improve this answer
At least I got a glimpse inside Apache's famous gut configuration. Gotta look on the bright side of bugs. – konzepz Sep 30 '09 at 20:27

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

share|improve this answer
I have both of these (::1 localhost / localhost) in .hosts file. – konzepz Sep 30 '09 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.

share|improve this answer
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 '09 at 20:21

Your Answer


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.