Problem with VirtualHosts
Posted by: lpeek (---.bb.sky.com)
Date: June 03, 2012 11:00PM

Hi all, I'm pulling my hair out trying to get a simple virtualhost to work!

i can view my www directory by typing localhost, but I want to type 'devhost' which will take me to www/devhost

I've set up everything as per various instructions/tutorials and I'm having one issue. localhost works, but devhost just takes me back to localhost.

Looking in the apache error log I have this entry:
[Sun Jun 03 21:51:02 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/Apache2, referer: [devhost]

This is my hosts file:

127.0.0.1       localhost
127.0.0.1       devhost

and the additions to httpd.conf:

# Tells Apache to identify which site by name
NameVirtualHost *:80

# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/wamp/www"
</VirtualHost>


<VirtualHost 127.0.0.1>
ServerName devhost
DocumentRoot "C:/wamp/www/devhost"
<Directory "C:/wamp/www/devhost">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>

Options: ReplyQuote
Re: Problem with VirtualHosts
Posted by: stevenmartin99 (Moderator)
Date: June 03, 2012 11:11PM

first of all , dont do this in the httpd.conf - its messy.

use the vhosts file

include it at the bottom of the http.conf by removing the #

second your binding to a ip which is incorrect.

use


NameVirtualHost *:80


<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/wamp/www"
</VirtualHost>


<VirtualHost *:80>
ServerName devhost
DocumentRoot "C:/wamp/www/devhost"
<Directory "C:/wamp/www/devhost">
</VirtualHost>

to test first if its ok

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Problem with VirtualHosts
Posted by: lpeek (---.bb.sky.com)
Date: June 03, 2012 11:23PM

That actually done the job! Thanks Steven!

What is it about using VirtualHost *:80 instead of an IP? as all the example cost posted around by other people seem to use an ip and it works for them?

Thanks for the pointer on vhosts! I didn't even realise that file existed!

Thanks!

Options: ReplyQuote
Re: Problem with VirtualHosts
Posted by: stevenmartin99 (Moderator)
Date: June 03, 2012 11:34PM

well if you check , apache is bound onto localhost

its gloming onto 0.0.0.0:80 or ::1:80

so just forget the ip and mention the port because it is bound to a port

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 1 time(s). Last edit at 06/03/2012 11:35PM by stevenmartin99.

Options: ReplyQuote
Re: Problem with VirtualHosts
Posted by: yfastud (Moderator)
Date: June 12, 2012 01:05AM

No matter within or outside LAN access, you need to setup Access, DNS, and VH; Access for permission to connect to your Wamp PC, DNS to tie Domain(s) to your Wamp PC. If dont have real Domain, just skip DNS guide

To setup Access, follow this
[blog.jlbn.net]

To setup VH, follow this
[blog.jlbn.net]

To setup DNS, follow this
[blog.jlbn.net]

Have fun,

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

Options: ReplyQuote
Re: Problem with VirtualHosts
Posted by: virat.gaywala (203.190.151.---)
Date: May 06, 2014 07:47AM

Hi,

For complete information on how to set up multiple virtualhosts using wamp server in windows environment please check out my blogs.

URL: [viratgaywala.blogspot.in]

Options: ReplyQuote


Sorry, only registered users may post in this forum.