Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
F: +44 (0)8456 446 899 / +44 (0)1223 359459
E: enquiries@precedence.co.uk
Webserver-vhosts

Jump To: Support > KB > NetManager > Webserver > vhosts

Virtual hosts for other domains

NetManager can host as many independent websites as you wish. It does this by looking at the domain name requested by the web-browser and selecting which website to serve on the basis of this. This is known as name-based virtual hosting.

To use virtual hosting, you need to do two things:

  1. Pointing the names in question (e.g. www.example.com) at your external IP address
  2. Create a sub-directory in the main webspace and configure NetManager to use this for the desired domain names.
There is currently no webadmin interface for configuring virtual hosts, but recent NetManager versions have a view-only interface that displays any configuration errors (e.g. sub-directory does not exist). The apache_virtualhost configuration file option contains a space-separated list of sub-directory,domain-name pairs. For example:
apache_virtualhost="example,www.example.com example,example.com"

In the example above, both www.example.com and example.com (because people often miss off the www when typing an address into their browser) will be served using the documents in the example sub-directory (actual path /usr/export/home/www/example or \\netmanager\Webpages\example).

Once you have edited the configuration file, run the apache build script.

Virtual hosts by IP address or port number (advanced)

In addition to name-based virtual hosts, different websites can be selected by the IP address or port number on the server that the browser connects to. To configure an IP/port virtual host, specify the IP address (and optionally port, defaults to 80 is not specified) in addition to the directory,domain-name option in the apache_virtualhost configuration file option, i.e. format is:

directory,domain-name,IP-address:port,SSL-certificate

If the directory begins with / it specifies an absolute path to the website. If it begins with ~user, it is in the home directory of user (can also specify a sub-directory). Otherwise, it specifies a subdirectory of the main webspace.

If specifying an IP address, you do not need to specify a domain name. If no domain name is given, the website specified will be served whatever the address used in the browser, otherwise normal name-based virtual host rules apply as above.

You may also skip the IP address part if you just want to distinguish by port number. Port 443 is specifically handled, it will enable https if an SSL certificate is defined and enabled for the webserver. If you do not give an SSL certificate in the config, it will use the global one defined for the webserver.

So, for example (all on one line):
apache_virtualhost="example,www.example.com example,www.example.com,:443 
test,,10.20.30.40 test1,www.test.com,10.20.30.40
test1,www.test.com,10.20.30.40:443,www.test.com:live test2,,10.20.30.40:81"

For this example, let us assume www.example.com points to 10.20.30.10 and www.test.com points to 10.20.30.40.

N.B. You will need to configure the webserver to listen on any non-standard ports by adding them to the apache_additional_ports configuration file option.

Webadmin screenshot

© Copyright Precedence Technologies 1999-2017
Page last modified on January 25, 2017, at 07:30 PM by sborrill