3

Help!

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
</Directory>

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

Buggy Result

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

3 Answers 3

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.

1
  • 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
0

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

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

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 127.0.0.1.

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.

1
  • 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .