[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I use more then one host??




>
>Hi John,
>
>Im using your WEB server for my WEB-SERVER, and Im wondering is it possible
>to adress more then one HOST if you have one one IP adress on the machine?
>
>I use www.site1.no, and I want to use www.site2.com, but have diffrent
>data
>on the to hosts, is this possible?
>
^^^^
Yes this is possible, and an example is given in the tutorial 
(test suite) - however I think its beneficial to go over this to solve
your specific needs. I'm assuming you're on an NT or Win95 OS. 

Setting up Multiple virtual Hosts (Non-IP)
------------------------------------------
The main host is www.site1.no, the virtual host is www.site2.com

Install (or reconfigure) the Pi3Web server using www.site1.no as 
the hostname, the administrator password will be webmaster@site1.no 
or something.

After satisfying yourself that the server is behaving properly for
www.site1.no stop the server and the admin GUI, use your favourite
text editor to open Conf\Config.pi3 - you will modify this file to add
a virtual host.

i)
Find the lines:
# ---
# Main virtual host object.
# ---
<Object>
    Name MainVirtualHostInformation
    Class VirtualHostClass
    Administrator webmaster@site1.no
    HostName www.site1.no
</Object>
duplicate the 6 lines between <Object> and </Object> to define the
attributes of the new virtual host - so the newly added 6 lines may 
look like:
<Object>
    Name Rydmark.com
    Class VirtualHostClass
    Administrator webmaster@site2.com
    HostName www.site2.com
</Object>

ii)
Find the line:
    HostMap ReturnCode ReturnCode=COMPLETED
and insert the following line before it:
    HostMap VirtualHostByName HostName="www.site2.com" VirtualHostObject="Rydmark.com"
This causes the HostMapping phase of request processing to use the newly 
defined alternate virtual host attributes if the 'Host' header matches www.site2.com

iii)
To have a different document root for this virtual host, find the line:
    Mapping PathMapper From="/" To="WebRoot\"
and a line like the following before it:
    Mapping Condition="&cmp(&dblookup(request,rfc822,Host),www.site2.com)" PathMapper From="/" To="www.site2.com\"
this will map '/' to the directory 'www.site2.com' if the 'Host' request 
header is 'www.site2.com'.

Save the file, start the server and test the new virtual host - use a web
browser that supports Non-IP virtual hosts (Host RFC822 header) - Netscape
3.0 or so works.

This setup gives a second virtual host with a different document root (/). Other
directory mappings (like /cgi-bin/...) are shared by all hosts as are logfiles - 
this is not necessarily so and virtual hosts can be made to be completely 
indepent from each in every respect if required (different doc-roots, logfiles,
cgi mappings, cgi configurations, security preferences etc.) - this is a 
simple example. You can have any number of Non-IP virtual hosts.

Hope this helps,
John

>