0

I'm trying to setup virtual host on my Windows machine. In my httpd-vhosts.conf file, I have this:

<VirtualHost *:80>
    ServerAdmin admin@localhost
    DocumentRoot "c:/wamp/www"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/blg"
    ServerName blg.com
</VirtualHost>

When I go to http://localhost, I see all the folders under c:/wamp/www, so that looks fine. However, when I go to http://blg.com, I expect to see the files in c:/wamp/www/blg, but I don't. Instead, I am seeing exactly what localhost sees: the files in c:/wamp/www. What's wrong with my setup?

halfer
  • 19,824
  • 17
  • 99
  • 186
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
  • What apache version are you using? If it’s below 2.4, you might need to add a [NameVirtualHost](http://httpd.apache.org/docs/2.2/en/mod/core.html#namevirtualhost) directive. – CBroe Jan 12 '15 at 22:54
  • 2.4.9 is the version I am using. – StackOverflowNewbie Jan 12 '15 at 23:13
  • See this post on how to setup virtual hosts properly http://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618 – RiggsFolly Jan 13 '15 at 08:54

1 Answers1

1

Apache has a fallback when a virtual host is not configured properly. It runs the FIRST Virtual Host it sees in your list of virtual hosts i.e. localhost in your case.

Your VHOST definitions are a bit lacking in content, and as you do not mention that you created an entry in the HOSTS file to match your blg.com domain that also could be one of your problems.

Check this post out, as part of it it describes how to setup a Virtual host properly.

Community
  • 1
  • 1
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149