Join 3,563 readers in helping fund MetaFilter (Hide)


There's no place like localhost... please help me get back there...
May 23, 2012 10:12 AM   Subscribe

Just installed Apache on a new machine, and now any calls to localhost goes to one of my VirtualServers instead of the docroot. Help!

I've read a dozen promising looking posts on various sites, but none of them seem to touch my problem...

I have a dev machine here (win7 / apache 2.2.21) which is supposed to be serving three things - localhost, site1.dev and site2.dev . No matter what I do, any attempt to browse the url http://localhost is serving me site1.dev instead.

Here's what looks like the relevant bits of my httpd.conf (irrelevant bits snipped ([...]).
[...]

Listen *:80

[...]

ServerName localhost:80
DocumentRoot "W:/wamp/www/"
<Directory "W:/wamp/www/">
   Options Indexes FollowSymLinks
   AllowOverride all
# onlineoffline tag - don't remove
   Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1
</Directory>

[...]

NameVirtualHost *:80

<virtualHost *:80>
   ServerName site1.dev
   DocumentRoot "W:\wamp\www\site1"
</VirtualHost>

<virtualHost *:80>
   ServerName site2.dev
   DocumentRoot "W:\wamp\www\site2"
</VirtualHost>

Any suggestions as to what I'm getting wrong?
posted by sodium lights the horizon to Computers & Internet (3 answers total)
 
Make a virtual host for localhost and/or * also. :)
posted by Monsieur Caution at 10:31 AM on May 23, 2012


From https://httpd.apache.org/docs/2.2/vhosts/name-based.html: “If you are adding virtual hosts to an existing web server, you must also create a block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.”
posted by kyten at 10:48 AM on May 23, 2012


Damnit. I knew I'd done something stupid, but that wins a prize.

Thanks guys...
posted by sodium lights the horizon at 11:22 AM on May 23, 2012


« Older Where was this circa 1970's ph...   |  What is the best way to clean ... Newer »
This thread is closed to new comments.