What service specifically? FOr the web, Apache has excellent virtual
hosting support, most other applications have varying degrees of name
based virtual hosting support. What exactly are you trying to host?
73 de VK3JED
http://vkradio.com
OK, go to http://apache.org, select the "Apache Web Server"
project. In the documentation section, there is a How-To on Apache
virtual hosting. You need to setup name based virtual hosting.
I suggest you have a read of the docs, it might help get an
overview. I can give you the answers here, but the extra reading
will help it stick. :)
In many stock Apache confing files, virtual hosting support is
written in, but commented out, to it should be easy to enable it. In
short, there are a couple of steps you have to do:
1. Enable name based virtual hosting (this one I sometimes forget,
because I'm used to working on systems where I did that years ago)
2. Setup the default virtual host, and any specific virtual hosts.
>Thanks. I did do some Apache reading a while ago but, as I read it, it
>suggested that the domain name resolution was private network.
>
>What I could not work out was how two external/public domains could be
>routed by IP address to a singular (common) address and then still be split
>to go to two virtual servers. Obviously I have missed something in my
>reading.
Note I mentioned name based virtual hosting. This means that the
virtual hosts are defined by the hostname in the HTTP request from
the browser. This allows the websites for multiple domains to be
hosted on the one Apache server with a single IP address.
In short, you need to add the following:
# Turn on virtual hosting on port 80
NameVirtualHost *:80
# My main 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.
# Note that /var/www/html is configured by a <Directory> section elsewhere
# in httpd.conf in my case.
#
<VirtualHost *:80>
ServerAdmin webm...@arlangdon.com.au
DocumentRoot /var/www/html
ServerName app1.arlangdon.com.au
</VirtualHost>
# Now add some other virtual hosts
<VirtualHost *:80>
ServerName forums.vkradio.com
ServerAlias forum.vkradio.com
DocumentRoot /var/www/vkradio
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel warn
HostNameLookups off
</VirtualHost>
<Directory "/var/www/vkradio">
Options Includes FollowSymLinks
AllowOverride AuthConfig
Allow from all
Order allow,deny
</Directory>
I strongly suggest going back to the docs to understand what's going
on here. :)
Note the ServerName and ServerAlias - These are the hostnames that if
requested by the browser will cause Apache to serve this virtual
host's content.
>".. the virtual hosts are defined by the hostname in the HTTP request from
>the browser. This allows the websites for multiple domains to be hosted on
>the one Apache server with a single IP address. ".
>
>I know the above works because it is done now. What I have not been able to
>work out is the detail. That is;- given the virtual hosts each sponsor a
>domain (by name), I still can't see how the individual external domain names
>are resolved when the only the one address is used;-
>
>Domain name Assigned IP Server IP
>Virtual Host
>www.a.com 10.20.30.40 \
> \
> 10.20.30.40:80
Foorget the IP, it's all done by the name requested in the HTTP
headers. Your thinking is stuck in the one name per IP mode. ;)
>-->my.www.svr.local
> / IP
>192.168.1.20
>www.b.com 10.20.30.40 /
>
>Both would be ported to the same virtual host (via port 80) but what is to
>distinguish www.a.com from www.b.com if all it knows is the IP address? Is
>the actual domain name transferred with the IP address?
No, Apache also knows what hostname was requested, as that
information is sent by the browser, so Apache knows what content to server up.
Browser looks up the IP for www.host1.com, gets an IP (e.g.
1.2.3.4). Browser makes HTTP connection to 1.2.3.4 and says "Give me
http://www.host1.com/". Apache looks up its configuration and sends
up the content related to the www.host1.com virtual host.
Next, the browser looks up www.host.com, gets the same IP
(1.2.3.4). Again, the HTTP request is made ("Give me
http://www.host2.com"), then Apache serves the content of the
www.host2.com virtual host.
It's all done at the application layer. Nice and easy. :) Now enjoy. ;)