Home | ||||
Virtual Hosts |
Host: www.sambar.com
The Sambar Server supports virtual-hosts using the Host: directive passed by most newer Web browsers (and is a required feature of HTTP/1.1). This is the only mechanism used by the Sambar Server to support virtual hosting.
The benefits of using the Host: directive for virtual hosting is that it allows for a near-unlimited number of WWW servers to be supported by a single machine. A significant disadvantage is that the user's browser must support this part of the HTTP/1.1 protocol. Netscape Navigator 2.0 and later, as well as Microsoft's Internet Explorer 3.0 and later support this functionality.
[*sambar.com]
Documents Directory = c:/company/docs/
Home Page = index.htm
Default Page = index.htm
Log File = sambarcom.log
CGI Directory = /cgi-bin/
WinCGI Directory = /cgi-win/
Automatic Log mailto = tod@sambar.com
In addition, the default host directives are still found in the config.ini file. Should the host directive not match any of the hosts in the vhosts.ini file, or no vhosts.ini file exist (the default), the defaults from the config.ini file are used.
The Documents Directory directive may contain a path relative to the Sambar Server installation (shown) or an explicit path (i.e. c:/foobar/docs/ ).
Using the above example, the following would be the configuration of the config.ini file:
The vhosts.ini file would have the following configuration:
[*sambar.com]
Documents Directory = /docs/
Home Page = index.htm
Default Page = index.htm
Log File = sambarcom.log
CGI Directory = /cgi-bin/
WinCGI Directory = /cgi-win/
So when a browser that does not support virutal hosting comes to the site, the default.htm page is shown. This page has explicit links to SAMBAR.NET (home.htm) and SAMBAR.COM (index.htm). All documents for SAMBAR.NET are maintained in a directory structure within the docs directory as are the pages of SAMBAR.COM.
To run multiple hosts, you first need to have an internet Name Server (DNS server), that points them to your IP address. See the How-To on DNS servers for more info on that subject. This will deal strictly with the Sambar side of virtual hosting.
1) Decide where the docs are going to reside. For this example, we'll pretend you chose "E:\vhosts\"
2) Create two directories in E:\vhosts\, one called "thisname", one called "thatname".
3) Create two index.html files (saying "welcome to thisname.com" and "welcome to thatname.com"), and put them in their directories. You should now have the following on your harddrive:
e:\vhosts\thisname\index.html
and
e:\vhosts\thatname\index.html
4) Go to your Sambar admin page (and login)
5) Under "Servers", "WWW Server", click on "Virtual Hosts"
6) Enter the following data:
Virtual Host Name | www.thisname.com |
Documents Directory | e:\vhosts\thisname\ |
Default Page | index.html |
Log File | access_thisname.log (or leave it blank, and all will be logged to access.log) |
Automatic Log mailto | (enter the name of the admin person for thisname.com, or leave blank) |
CGI Directory | /cgi-bin/ |
WinCGI Directory | /cgi-win/ |
7) Repeat step (6) for thatname.com.
8) Restart your server.
9) In your browser enter www.thisname.com and you should see "welcome to thisname.com"
10) In your browser enter www.thatname.com and you should see "welcome to thatname.com"
Mail
Keep in mind that mail is different from virtual hosts.
Setting up one will not set up the other, you have to do each individually.
Heres what to do to get mail for multiple domains.
1) Log in to the Sambar Admin page.
2) Under Servers, Mail Server, select Configuration
3) Scroll down a bit, and find Local Domains
4) Enter a list of domain names you are receiving mail for, each one separated by a space. You can use wildcards if you need to. Heres what ours looks like:
Local Domains = *the-crawfords.* *CentralChiropractic.com *sweetgrassSoftware.com
*explorer2260*.com *planetdog.ca *globalidi.net *globalidi.com
*workright-online.com *tearsintherain.com *the-music-makers.com
*ranmamusic.com *crawfordhistory.org *236scouts.org
The wildcard at the beginning of every domain allows sub-domains to receive mail too. Dont currently have any, but this way we dont have to make changes later.
You'll notice *the-crawfords.* doesnt have a .com ending, because we have the .com as well as .org. The wildcard allows mail for both to come in. Also, *explorer2260*.com allows mail for explorer2260.com, explorer2260dev.com, and explorer2260fan.com
Now, a problem will arise if you try and use the same account name under
each domain. Mail sent to joe@domain1.com and mail sent to joe@domain2.com
will both go to the mailbox joe
There is a way around this however!
When setting up user accounts, set them up, not as joe
,
but as joe@domain1.com
.
© 1998-2003 Sambar Technologies. All rights reserved. Terms of Use