VirtualHosts and differant domain names
Posted by: scott473 (---.twcny.res.rr.com)
Date: February 06, 2007 04:05AM

Hi, I know this has been answered a hundred times, and I have searched the forums for my answer. I appologize for asking again, but im a little slow and am not sure if I understand what I have read. lol


Would I comment out these 3 lines when setting up Virtual Hosts?

ServerName www.werever.com


DocumentRoot "C:/wamp/www/werever"


<Directory "C:/wamp/www/werever">


Then when I get down to this. I understand that I have to remove the # between tags, but what i dont understand is were its <VirtualHost *:80> am I supposed to change * to the domain name and so on for each domain name?

Also for each registered domain name, how would I point my differant nameservers to each differant virtual host?




# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

#Begin Host for domain example1.com
<VirtualHost *:80>
ServerAdmin webmaster@example1.com
DocumentRoot /www/docs/example1direcctory
ServerName example1.com
ErrorLog logs/example1.com-error_log
CustomLog logs/example1.com-access_log common
</VirtualHost>
#End host for domain example1.com

#Begin Host for domain example2.com
<VirtualHost *:80>
ServerAdmin webmaster@example2.com
DocumentRoot /www/docs/example2directory
ServerName example2.com
ErrorLog logs/example2.com-error_log
CustomLog logs/example2.com-access_log common
</VirtualHost>
#End host for domain example2.com

#Begin Host for domain example3.com
<VirtualHost *:80>
ServerAdmin webmaster@example3.com
DocumentRoot /www/docs/example3directory
ServerName example3.com
ErrorLog logs/example3.com-error_log
CustomLog logs/example3.com-access_log common
</VirtualHost>
#End host for domain example3.com



Thank you in advance for the help. I know somebody has my answer. smiling smiley

Options: ReplyQuote
Re: VirtualHosts and differant domain names
Posted by: CyberSpatium (71.237.217.---)
Date: February 06, 2007 09:57AM

signup for a dynamic ip service like zoneedit.com. zoneedit.com is free and the most popular dynmic ip service out there. you use this service to tie your ip address to your domain name. Do this by creating an A record that will connect your ip address to your domain name.it will then give you some nameservers so use. login to where you got your domain name and set the nameservers for your domain to the nameservers zoneedit gave you.

open up your apache config file httpd.conf ( c:\wamp\apache2\conf\httpd.conf ). you do not need to comment out any of those three lines you posted in your thread. what you do need to do is uncomment this line:
#NameVirtualHost *:80

change to:
NameVirtualHost *:80

that setting is what tells apache you are now using virtual hosts. now below the NameVirtualHost *:80 line add:

<VirtualHost *:80>
ServerAdmin webmaster@example1.com
DocumentRoot c:/wamp/users/example1.com/www
ServerName example1.com
ErrorLog c:/wamp/users/example1.com/logs/error_log
CustomLog c:/wamp/users/example1.com/logs/access_log common
</VirtualHost>

now, you can change the DocumentRoot setting above to anywhere on your computer, but to make things easier, you should put things all in one location, that way you dont have many websites located all over your computer.

I put all my virtual accounts in a folder called users in my c:\wamp folder. for this example you need to create a folder in the users folder called example1.com, you willl need to change example1.com to your actual domain name. then in the example1.com folder, i create two new folders, one called logs where apache will store the error and access logs for this domain. i then create another folder called www where your will store all your website files.

now save your httpd.conf file and restart apache for the new settings to take effect. also remember that when you change the nameserver setting for you domain it will take 24-78 hours to propagate though the internet. so, you will not be able to test your virtual host setting until your domain name has fully propagated. if you use godaddy.com to register you domain, their domain names propagate quickly and may only take a few minutes to fully propagate.




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

like my free support? help support me by checking out my new Newbie Webmaster Development Forum dedicated to the newbie webmaster here:
www.WebDevNewbie.com

Options: ReplyQuote


Sorry, only registered users may post in this forum.