Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

virtual host explanation 1

Status
Not open for further replies.

tony84

Programmer
Jul 3, 2002
17
FR
Hi,

i would like to understand what virtual host mean exactly, at apache they say :
virtual host is the ability to maintain one or more server on the same machine.

Does it mean that it has the ability to have many servers with different IP.
or does it mean many website address( , with same IP on the same machine.
Also if i get a domain name should use
<virtual Host>
....
</virtual Host>

thank you
anthony
 
If you have only one domain and don't plan on adding others, you don't need to use VirtualHost. If you do host more than one domain, then you will need to. There are two types of vhosts. If each domain has it's IP you would use IP based addressing. This is usually not the case unless you have multiple IPs. If you have just one IP you would use name based addressing. This is where you use the ServerName directive for each vhost. You can have as many vhosts as you want. It is usually only limited by the bandwidth your connection to the internet can handle. Vhosts can be either domains or sub-domains but the must be registered domain names. If you are considering buying a domain name, I would avoid Network Solutions. They are just plain too exspensive and any changes to your records takes an act of congress. There are a few good registrars out there. Godaddy has just about the best prices.
 
There are a few types of web hosting. One is to own or lease your own server and you have control over everything that happens on it. You can also have a webhosting service rent you a virtual server. This is where you rent space on their server for your web pages and pay a monthly fee. They would create a VirtualHost and directories on their drives for your domain. Another type is free web hosting and involves a sub-domain of their domain such as you.theirdomain.com or theirdomain.com/you. The catch to using free services is that you have to put up with pop up windows or banners on all your pages that advertise their service. If you own your own domain name (yourdomain.com), you would more than likely opt for one of the first 2 .
 
Hi,

I don't plan to do website hosting,
but two questions.
1) if you have 'you.theirdomain.com', do you have to create a virtual host that is my question?
2)is you.theirdomain.com a new Domain name or a subdomain ?


Anthony
 
1) Usually they host you're site if they give you a subdomain.
2) theirdomain.com would be the domain while the you.theirdomain.com is a subdomain. //Daniel
 
If you don't plan on hosting a website, then you don't have to worry about virtual host. An example of a domain would be yourdomain.com a sub-domain would be or chat.yourdomain.com and something_else.yourdomain.com. When you buy a domain name, you get yourdomain.com. You can have as many sub-domains of that domain as you like. Some web hosting services let you add them yourself while other don't allow them at all but that doesn't mean you can't have them on another server. In this case, you would create another &quot;A&quot; record for whatever.yourdomain.com and point it to another hosts IP. The best thing to do is ask the hosting provider if the allow sub-domains and if they say yes, they have there VirtualHosts setup to find your sub-domains under your domain's web space.
 
Hi,

ok thank you sorry to bother you.
what i meant for question #1 each time you add a new account or new user do you have to upgrade the <virtual host> and his virtual host like <virtual host you.theirdomain.com>
</VH>

or can you just leave and do not worry aftwards.

Regards,
Anthony
 
it's no bother at all. It's just that you said you do not plan to do any web hosting but you ask questions about how to set up a server for it. I think I'm starting to understand what you are asking now. Let me see if I'm right.

1. You have or will get your own domain.
2. You will have users that will have there own web space on your server.
3. You want them to be able to access their sites with username.yourdomain.com or yourdomain.com/~username.
4. You want to know if you need to edit httpd.conf and restart apache every time a new user is added.

Is this correct? If it is, then the answer is no. You just have to use the UserDir directive and create a container for it. Here's an example:

<IfModule mod_userdir.c>
UserDir public_html
</IfModule>

<Directory /home/*/public_html>
AllowOverride None
Options MultiViews Indexes
Order allow,deny
Allow from all
</Directory>

This will allow each user to have their own web space in their /home/ directory called &quot;public_html&quot;. You can either let them have their own cgi-bin, share one or none at all. The above is just an example so you would edit it to however you want to allow access. I also didn't add a cgi-bin container.
 
Hi,

yes it is true i don't want to be web host because i can't but I think it is very interesting how they set up everything, anyhow:
so the big web hosts use :
&quot;mass VH&quot; or &quot;directive&quot;.

but i another quick question.
How do they add banners, I can only guess that it is apache who does the job.

thanx again
anthony
 
Yes, you can add a header or footer to all pages with apache without having to edit any of them. The headers or footers can be html which call a banner rotation script or just about anything else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top