Sun Java System Web Server 7.0 Update 7 Administrator's Guide

Chapter 5 Using Virtual Servers

Overview of Virtual Servers

When you use virtual servers you can offer companies or individuals domain names, IP addresses, and some server monitoring capabilities with a single installed server. For the users, it is almost as if they have their own web servers, though you provide the hardware and basic web server maintenance.

All virtual servers have an HTTP Listener specified. When a new request comes in, the Server determines which virtual server to send it to based on the configured HTTP Listener.

Use Cases

Server instances can have any number of HTTP Listeners, both secure and non-secure. You can have both IP-address-based and URL-host-based virtual servers.

Every virtual server can (but does not have to) have its own list of ACLs, its own mime.types file, and its own set of Java Web Applications.

This design gives you maximum flexibility to configure the server for a variety of applications. The following examples discuss some of the possible configurations available for Web Server .

Default Configuration

After a new installation of the Web Server , you have one server instance. This server instance has just one HTTP Listener listening on the port you selected during installation of any IP address to which your computer is configured.

Some mechanism in your local network establishes a name-to-address mapping for each of the addresses to which your computer is configured. In the following example, the computer has two network interfaces: the loopback interface (the interface that exists even without a network card) on address 127.0.0.1, and an Ethernet interface on address 10.0.0.1.

The name example.com is mapped to 10.0.0.1 via DNS. The HTTP Listener is configured to listen on port 80 on any address to which that machine is configured ("ANY:80" or "0.0.0.0:80").

In this configuration, connections to the following reach the server and are served by virtual server VS1

Use this configuration for traditional web server use. You do not need to add additional virtual servers or HTTP Listeners.

Secure Server

See Configuring SSL for the Server.

Intranet Hosting

A more complex configuration of the Web Server is one in which the server hosts a few virtual servers for an intranet deployment. For example, you have three internal sites where employees can look up other users’ phone numbers, look at maps of the campus, and track the status of their requests to the Information Services department. Previously (in this example), these sites were hosted on three different computers that had the names phone.example.com, maps.example.com and is.example.com mapped to them.

To minimize hardware and administrative overhead, you can consolidate all three sites into one web server living on the machine example.com. You could set this up in two ways: using URL-host-based virtual servers or using separate HTTP Listeners. Both have their distinct advantages and disadvantages.

Intranet hosting using URL-host-based virtual servers

While URL-host-based virtual servers are easy to set up, they have the following disadvantages:

You can also set up the IP-address-based configuration with one HTTP Listener per address.

Intranet hosting using separate HTTP Listeners

The advantages of IP-address-based virtual servers are:

The disadvantages are:

Both configurations require setting up name-to-address mappings for the three names. In the IP-address-based configuration, each name maps to a different address. The host machine must be set up to receive connections on all these addresses. In the URL-host-based configuration, all names can map to the same address, the one the machine had originally.

The configuration with multiple HTTP Listeners may give you a minimal performance gain because the server does not have to find out the address where the request arrived. However, using multiple HTTP Listeners also results in additional overhead (memory and scheduling) because of the additional acceptor threads.

Mass Hosting

Mass hosting is a configuration in which you enable many low-traffic virtual servers. For example, an ISP that hosts many low-traffic personal home pages would fall into this category.

The virtual servers are usually URL-host-based. For example, you can have one configuration that enables only static content, and another one that enables static content and CGIs.

Managing Virtual Servers

Adding a Virtual Server

ProcedureTo Add a Virtual Server

Before You Begin
  1. Select the configuration from which you will need to add a virtual server. You can select the configuration from the list of configuration shown in the Configurations tab.

  2. Click on the Virtual Servers tab > New button.

    A pop-up wizard page appears to guide you through the Virtual Server configuration process.

  3. From the wizard page, perform the following tasks:

    • Enter the new virtual server information:

      1. Enter a name to identify the new virtual server. The name can be alphanumeric and can also include period (.), dash (-) and underscore (_) characters.

      2. (Optional) Enter a list of hosts to be added to the new virtual server.

      3. (Optional) Enter the document root for the virtual server.

    • Select an HTTP listener for the newly configured virtual server. You can either choose an existing HTTP listener or create a new HTTP listener.

  4. The wizard summary page appears. To change the configuration, go back to the previous pages by clicking Previous. Click Finish to complete the new virtual server configuration process.

  5. The Results page appears. If you see any error, Configure the virtual server again by going back to the previous pages in the wizard.


    Note –

    Using CLI

    To add a virtual server through CLI, execute the following command:


    wadm> create-virtual-server --user=admin --password-file=admin.pwd 
    --host=serverhost --port=8989 --config=config1 --document-root=../docs config1_vs_1

    See CLI Reference, create-virtual-server(1).


Configuring a Virtual Server

To configure virtual server's general settings, perform the following task:

ProcedureTo Configure a Virtual Server

  1. Select the configuration from the configuration list. Click Configurations tab to get the list of available configurations.

  2. Select the virtual server from the virtual server list. Click Virtual Servers tab to get the available virtual servers for the selected configuration.

  3. Click General tab. Configure the following settings.

    • Enabled — Whether the virtual server is enabled at runtime.

    • Document Root — The document root path for the virtual server, where the virtual server's data will be stored. This includes exploded web application directories and log files.

    • Hosts — You can enter more than one URL host, separated by commas.

Duplicating a Virtual Server

To duplicate a virtual server, perform the following task:

ProcedureTo Duplicate a Virtual Server

  1. Select the configuration from the configuration list. Click the Configurations tab to get the list of available configurations.

  2. Select the virtual server from the virtual server list. Click the Virtual Servers tab to get the available virtual servers for the selected configuration.

  3. Click, Copy and provide a name for the new virtual server.


    Note –

    Using CLI

    To duplicate a virtual server through CLI, execute the following command:


    wadm> copy-virtual-server --user=admin --password-file=admin.pwd --host=serverhost 
    --port=8989 --config=config1 --vs=config1_vs_1 copiedVs

    copiedVS is the name of the new virtual server.

    See CLI Reference, copy-virtual-server(1).


Configuring HTTP Listeners

The Server accepts the HTTP requests via an HTTP Listener before forwarding the request to the configured Virtual Server. This page enables you to add and configure HTTP Listeners.

HTTP Listeners must have a unique combination of port number and IP address. You can use either IPv4 or IPv6 addresses. Setting the IP address to “*” creates an HTTP Listener that listens on all IP addresses on that port.

Creating a HTTP Listener

You can create a new HTTP Listener for a Virtual Server for processing incoming HTTP requests performing the following steps:

  1. Click the Virtual Servers tab under Configurations tab.

  2. Click the HTTP Listeners sub tab to view the list of configured HTTP Listeners.

  3. Click the New button to open a wizard page that creates a new HTTP Listener.

Provide the following information in the wizard page.


Note –

Using CLI

For creating a HTTP Listener through CLI, execute the following command.


wadm> create-http-listener --user=admin --password-file=admin.pwd --host=serverhost 
--port=8989 --listener-port=18003 --config=config1 --server-name=config1.com 
--default-virtual-server-name=config1_vs_1 config1_ls_1

See CLI Reference, create-http-listener(1).


Configuring Your HTTP Listener

You can edit the existing HTTP Listener settings by performing the following tasks:

  1. Click the Virtual Servers tab under a Server Configuration, for editing an existing HTTP Listener setting.

  2. Click the HTTP Listeners sub tab to view the list of configured HTTP Listeners.

  3. Under the Listener Name table column, click the HTTP Listener you need in order to edit its setting.

You can edit both the general and security related settings for the HTTP Listener.

Modifying HTTP Listener Parameters

Click the General tab to edit basic and advanced HTTP Listener settings. Configure the following options:

Select the Configure Advanced Settings option under the Advanced section to edit HTTP Listener advanced settings. Configure the following options: