Configuring Virtual Hosts (oh yes that dreaded question)
Posted by: afroboy360 (---.sol2.cable.ntl.com)
Date: March 24, 2008 02:30PM

Right

Firstly let me Say that i think this software is a brillian bit of kit winking smiley
Im usally an IIS man so am having some trouble with Apache and need some advice, let me give you some back ground Info

I have wamp server up and running fine, with 3 subdirectories located under C:\wamp\www these are as follows

\blog
\laronline
\intranet

i also have 3 domain names (I think you know where im going with this) these are pointed to my external IP and forwarded from my router to my server etc....etc
below is where i want the domains pointing to

network.afroboy.co.uk ==> \intranet
www.afroboy.co.uk ==> \blog
www.laronline.co.uk ==> \laronline

My server has 1 IP address so i thought i need to configure Vhosts right? so my next step was to open the httpd.config file and add the following code

#************************************************************************

#code i have added from here in order to direct websites


#IDENTIFYING VIRTUAL HOST
NameVirtualHost 192.168.1.110:80

#DIRECTING NETWORK.AFROBOY.CO.UK
<VirtualHost 192.168.1.110:80>
ServerName intranet.local
ServerAlias network.afroboy.co.uk
DocumentRoot C:/wamp/www/intranet
</VirtualHost>

#DIRECTING AFROBOY.CO.UK TO BLOG FOLDER
<VirtualHost 192.168.1.110:80>
ServerName afroboy.local
ServerAlias www.afroboy.co.uk
DocumentRoot C:/wamp/www/blog
</VirtualHost>

#DIRECTING LARONLINE.CO.UK TO PROFILE FOLDER
<VirtualHost 192.168.1.110:80>
ServerName laronline.local
ServerAlias www.laronline.co.uk
DocumentRoot C:/wamp/www/laronline
</VirtualHost>

#********************************************************************

once i had done this i then navigated to the following
C:\WINDOWS\system32\drivers\etc

opended the hosts file and edited with the following

#*********************************************************************
#stuff i have written below

192.168.1.110 afroboy.local
192.168.1.110 laronline.local
192.168.1.110 intranet.local

#**********************************************************************


now wehn i navigate to the following URL's I achive the following results

network.afroboy.co.uk = opens the right page in the right directory, Yippee
www.laronline.co.uk = opens the right page in the right directory

www.afroboy.co.uk = seem's to point the prowser to localhost???? i have no idea why it does this



My servers on now so if you want to test the above URL's feel free
Any suggestions on what im missing out would be greatly appreciated

Options: ReplyQuote
Re: Configuring Virtual Hosts (oh yes that dreaded question)
Posted by: yfastud (Moderator)
Date: March 24, 2008 09:27PM

Did you check Setup Virtual HOst guide on my personal website? If not, check it to get the idea

Have fun,

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

Options: ReplyQuote


Sorry, only registered users may post in this forum.