Virtual Hosts just dont seem to work
Posted by: radarsmit (---.den.clearwire-wmx.net)
Date: September 14, 2011 04:14AM

I've been trying to get virtual hosts to work for quite some time and I've followed many tutorials on how to do it and it just doesn't seem to be working..

My installation directory is the normal c:/wamp/ directory and [localhost] worked just fine before I started doing the virtual host thing.

I opened up my hosts file in c:/windows/system32/drivers/etc/ folder and put these 2 lines at the beginning:

127.0.0.1 localhost
127.0.0.1 mylocalsite.loc

I've also tried just mylocalsite, and ive tried adding in www.mylocalsite.loc and www.mylocalsite in the hosts file. I put those at the beginning because spybot search and destroy likes to append stuff to the end of the file a lot.

I then uncommended the Include conf/extras line to include the vhosts.conf file for apache.

I created the folder mylocalsite inside c:/wamp/www/ and created the logs folder as well..

right now in my httpd-vosts.conf file all I have is:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/wamp/www/mylocalsite"
ServerName mylocalsite.loc
ErrorLog "C:/wamp/www/mylocalsite/logs/error.log"
CustomLog "C:/wamp/www/mylocalsite/logs/access.log" common
</VirtualHost>

Once I did that, I went and restarted all services associated with WAMP, and wait to see if the icon turns green -- which it does...

So i try and visit mylocalsite.loc and firefox automatically appends www. onto the domain, and it tells me there is a problem loading a page because there is no server at www.mylocalsite.loc (even when i configured it to be www.mylocalsite.loc)

and when i go to [localhost] it brings me to the mylocalsite directory and the error logs show:

[Tue Sep 13 20:08:12 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/httpd-2.2-x64, referer: [localhost]
[Tue Sep 13 20:08:13 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/httpd-2.2-x64, referer: [localhost]

Now i notice that when I open up cmd and try to ping it, it tells me that the ping request could not find the host.

Any ideas?

Options: ReplyQuote
Re: Virtual Hosts just dont seem to work
Posted by: yfastud (Moderator)
Date: September 14, 2011 05:11AM

Quote

firefox automatically appends www. onto the domain
Seem either browser add-on or firewall/antivirus causes that issue

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Virtual Hosts just dont seem to work
Posted by: radarsmit (---.den.clearwire-wmx.net)
Date: September 14, 2011 07:06AM

Figured this out, what it turned out to be is that my hosts file, for some reason (i have ownership of it), was writing to hosts.txt instead of just hosts and so all the changes I was doing, wasn't actually doing anything.

Once I went back to that directory to take a look and noticed that, i corrected that issue and all is working now.

Options: ReplyQuote


Sorry, only registered users may post in this forum.