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
konzepz
  • 209
  • 1
  • 2
  • 7

3 Answers3

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.

konzepz
  • 209
  • 1
  • 2
  • 7
  • 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
0

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

crb
  • 7,998
  • 1
  • 38
  • 53
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.

Rob F
  • 396
  • 1
  • 7
  • 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