0

I am attempting to set up a local WAMP server and I am running into a problem with mapping domains to directories. When I just do one directory it works fine, but once I add another it doesn't work. This is what I have in my vhosts file.

NameVirtualHost *:80

<Directory "D:\server ">
  Order Deny,Allow
  Allow from all
</Directory>


#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#


NameVirtualHost 127.0.0.1


<VirtualHost 127.0.0.1>
   DocumentRoot "d:\server\ctlife"
   ServerName site1.local
</VirtualHost>


<VirtualHost 127.0.0.1>
   DocumentRoot "d:\server\phpmyadmin"
   ServerName site2.local
</VirtualHost>

And then in my hosts file I have put in this

127.0.0.1 site1.local
127.0.0.1 site2.local

If i take out site2.local in both files everything works fine, but doesn't seem to recognize the other one. I have followed a bunch of tutes on this and can't figure out what I am doing wrong.

migrated from stackoverflow.com Jun 26 '10 at 11:29

This question came from our site for professional and enthusiast programmers.

  • You have 2 NameVirtualHost, try removing the 2nd one or the 1st and maybe it is conflicting... ALSO you have a space at <Directory "D:\server "> could you try remove it... i know it may not be the problem but might be interfering with apache. – Prix Jun 26 '10 at 2:23
  • Did that worked ? by the way what is in your error_log file from apache – Prix Jun 26 '10 at 2:31
0

I prefer to have a full NameVirtualHost statement with IP and port, such as

NameVirtualHost 127.0.0.1:80

I would try that and remove the duplicate/overlapping NameVirtualHost statements. Also adjust your VirtualHosts to include IP:Port like:

<VirtualHost 127.0.0.1:80>
  ...
</VirtualHost>

Should do the trick. Good luck! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy