Virtual Hosts
Posted by: schnoodles (---.diverse-projects.net)
Date: March 03, 2006 05:11PM

Hello i am running the latest up to date WAMP package, but i am trying to get Virtual Hosts working so i can make a dud web address as in [i6x2.com] and point it to DocumentRoot www\Work\i6x2.com but when ever i follow [httpd.apache.org] it for some reason doesnt load my apache and my WAMP stays as the yellow icons.

I have no idea why this is andive checked the error logs and nothing appears in that.

If anyone has had the same problems or knows how to overcome this i am in GREAT need for it :\

Options: ReplyQuote
Re: Virtual Hosts
Posted by: schnoodles (---.diverse-projects.net)
Date: March 04, 2006 02:21PM

Anyone have any idea why it doesnt. I am in alot of need for it atm and ive tried so many different ways and none of them seem to want to work for me sad smiley

Options: ReplyQuote
Re: Virtual Hosts
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: March 04, 2006 04:22PM

be advised that hosting domain virtual hosts is a huge security risk. WAMP was designed to be specificaly for php and mysql design, development, and testing. it is not designed to be a fully functioning domain name server.

you can host domains WAMP, you will need to use a Dynamic IP service to manage DNS for you. then you add your domains to the vhost settings in your httpd.conf file

Options: ReplyQuote
Re: Virtual Hosts
Posted by: schnoodles (---.diverse-projects.net)
Date: March 04, 2006 05:07PM

Any idea how to do that. The reason why i want to do it is so i can do include("modules/index.php"winking smiley; instead of include("site/modules/index.php"winking smiley due to i am not creating my site in /www/ but /www/work/*

Do you know any way around this at all ?

Options: ReplyQuote
Re: Virtual Hosts
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: March 05, 2006 05:41AM

I don’t have all the time it would take to go into explicit step by step detail on how to do this. If is very technical. You need to know now to set Name Servers for your domain name, setup dynamic DNS for you domain name, and how to setup the vhost section of your httpd.conf file. If you get stuck, search Google for help.
WAMP does not come with a DNS server, so you need to use a DNS service to setup DNS for you domain name. Signup for DNS service at EveryDNS, it is a free DNS service:
[www.everydns.net]

Notice that on EveryDNS home page, they list the Name Servers to use to make their DNS service work with your domain name. You need to login to where you registered your domain name and go to your domain name administration panel and set the domain names Name Server settings to this:
Set Name Server one to:
ns1.everydns.net

Set Name Server two to:
ns2.everydns.net

And so on…
ns3.everydns.net
ns4.everydns.net

Now, login to your new EveryDNS account. Find the setting Add new domain and in the box just below it, add your domain name like this:
yourdomain.com
Make sure you do not enter your domain name in this format:
www.yourdomain.com or [yourdomain.com]

Now click on the circle next to Make domain dynamic and then click on the >> Advanced button. After you click the button, your domain name is automatically setup with the A NAME record making your domain DNS sync with your IP address (your WAMP server). Now, we need to add a CNAME record so people can also access your site using www.yourdomain.com instead of just yourdomain.com.

Click on the domain name you just added in your EveryDNS admin account. Now, you need to use the Add a record to add the new CNAME record for your domain. Use these settings:

Fully Qualified Domain Name: www.yourdomain.com
Record Type: CNAME
Record Value: yourdomain.com
If MX Record, MX Value: (leave blank)

Now click on the Add Record button, and your new CNAME record will be added to your domain names DNS settings.

One note before we move on to the next step. After you login and change the Name Server settings for you domain name, it will take between 12-48 hours for your new settings to take effect. So, after you follow all these steps to setup domain hosting, and then try to access your site using your domain, it will not work until your name server settings propagate though the Net. So… If you cannot access your website using your domain name, keep trying about every hour or so until it works.

Now we need to setup where we are going to store your website for your domain. For security reasons, we do not include it in the same directory where your www folder is. Make a new folder named users and put it here:
c:\wamp\users

Now, open the new users folder you just created, create a new folder there named www.yourdomain.com. Now, go to the new www.yourdomain.com folder you just made, and make two new folders, one named public_html and one named logs. The public_html is where you will place your website files in for your domain. The logs folder is where we will put the access and error logs for your domain name in.

Open notepage, and create a new text file using this html code:
<br /><br /><div align=”center”>
This is a test page. This in only a test.
</div>

Save the file as index.html and save it here:
C:\wamp\users\www.yourdomain.com\public_html\index.html

This page is used for testing. When all the settings you have made works, you can test to see if your domain name is working by accessing: [www.yourdomain.com]

It should display the test html page we just made. If not, then your domain name settings have not propagated yet.

Now we need to edit your httpd.conf file, located in this folder:
c:\wamp\apache2\conf\

Now scroll down to the bottom of the file. Near the bottom you will see:
#NameVirtualHost *:80

Change it to this:

NameVirtualHost *:80

#
#### locahost ####
#

<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot C:/wamp/www
ServerName localhost
ErrorLog C:/wamp/apache2/logs/error.log
CustomLog C:/wamp/apache2/logs/access.log common
<Directory "C:/wamp/www">
Options Indexes FollowSymLinks Includes +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>



#
#### yourdomain.com ####
#

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot C:/wamp/users/www.yourdomain.com/public_html
ServerName www.yourdomain.com
ServerAlias yourdomain.com
ScriptAlias /cgi-bin/ C:/wamp/users/www.yourdomain.com/public_html/cgi-bin/
ErrorLog C:/wamp/users/www.yourdomain.com/logs/error.log
CustomLog C:/wamp/users/www.yourdomain.com/logs/access.log common
<Directory "C:/wamp/users/www.yourdomain.com/public_html">
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "C:/wamp/users/www.yourdomain.com/public_html/cgi-bin">
Options Indexes FollowSymLinks Includes +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Now, save httpd.conf, restart apache, and your new settings will now take effect. Remember that your new Name Server settings will take some time to propicate though the Net before you domain name becomes active.



Post Edited (03-05-06 05:46)

CyberSpatium
----------------------
WAMP Forum Admin

Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.

Options: ReplyQuote
Re: Virtual Hosts
Posted by: pete (---.gtcust.grouptelecom.net)
Date: March 07, 2006 11:27PM

I used a different method...

go to your %systemdir%/system32/drivers/etc/hosts file. Open it with notepad or something like that.

Now, if this is for testing only, you can add some domain names.

Lets say you're calling yourself local.com like I did, add the line

127.0.0.1 local.com

if you want subdomains add the following for each different subdomain you want to work with.

127.0.0.1 subdomain.local.com

Once thats done, open command line and do "ipconfig /flushdns"

from now on, those domains will loop back to your computer just like localhost does.

All you have do to is configure the virtual hosts with the same subdomains and you're set for testing.

Options: ReplyQuote
Re: Virtual Hosts
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: March 08, 2006 07:09PM

all the domains you add to your hosts file will only be accessable by you. no one else will be able to connect to your WAMP using that domain.

so, if you want to use domain names and have them accessable by others on the internet, you need to use virtual hosts.

Options: ReplyQuote
Re: Virtual Hosts
Posted by: yfastud (72.236.169.---)
Date: March 09, 2006 07:55PM

Wow CyberSpatium! You said you don't have time but you went over so detail. Rep point for you.
I personally like zoneedit for DNS services.
In addition, I've just learned new thing from CyberSpatium that is I can set up cgi access in vhost, and don't laugh at me cause I'm a newnie. Anyway, another rep point for you.
I have a question for you regarding cgi that can I set up different cgi-bin folder for different user if I have more than 1 user? This is for my practice knowledge only and no bussiness involve here.

Options: ReplyQuote
Re: Virtual Hosts
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: March 09, 2006 09:07PM

make sure you install the ACTIVESTATE PERL ADD-ON before you can use cgi/perl.

to make cgi work in your webroot folder instead of the cgi-bin folder, change:

#
#### yourdomain.com ####
#

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot C:/wamp/users/www.yourdomain.com/public_html
ServerName www.yourdomain.com
ServerAlias yourdomain.com
ScriptAlias /cgi-bin/ C:/wamp/users/www.yourdomain.com/public_html/cgi-bin/
ErrorLog C:/wamp/users/www.yourdomain.com/logs/error.log
CustomLog C:/wamp/users/www.yourdomain.com/logs/access.log common
<Directory "C:/wamp/users/www.yourdomain.com/public_html">
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "C:/wamp/users/www.yourdomain.com/public_html/cgi-bin">
Options Indexes FollowSymLinks Includes +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

To this:


#
#### yourdomain.com ####
#

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot C:/wamp/users/www.yourdomain.com/public_html
ServerName www.yourdomain.com
ServerAlias yourdomain.com
ScriptAlias /cgi-bin/ C:/wamp/users/www.yourdomain.com/public_html/cgi-bin/
ErrorLog C:/wamp/users/www.yourdomain.com/logs/error.log
CustomLog C:/wamp/users/www.yourdomain.com/logs/access.log common
<Directory "C:/wamp/users/www.yourdomain.com/public_html">
Options Indexes FollowSymLinks Includes +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</VirtualHost>

Options: ReplyQuote
Re: Virtual Hosts
Posted by: logisch (---.dip.t-dialin.net)
Date: November 02, 2006 04:20PM

just for the records, the sample is missing the dir-section closing statment
to be inserted in the last but one line:

</Directory>

-Alex.
PS: with adequate indention in the config file its harder to miss such problems.

Options: ReplyQuote
Re: Virtual Hosts
Posted by: CyberSpatium (71.237.217.---)
Date: November 02, 2006 06:03PM

well, you cant indent when posting in this forum.

CyberSpatium
WAMP English Forum Admin

Options: ReplyQuote


Sorry, only registered users may post in this forum.