Sun GlassFish Enterprise Server v3 Prelude Administration Guide

Administering Virtual Servers

A virtual server, sometimes called a virtual host, is an object that allows the same physical server to host multiple Internet domain names. All virtual servers hosted on the same physical server share the IP address of that physical server. A virtual server associates a domain name for a server (such as www.aaa.com) with the particular server on which Enterprise Server is running. Each virtual server must be registered with the DNS server for your network.


Note –

Do not confuse an Internet domain with the administrative domain of Enterprise Server.


For example, assume that you want to host the following domains on your physical server: www.aaa.com, www.bbb.com, and www.ccc.com. Assume that these domains are respectively associated with web modules web1, web2, and web3. This means that the following URLs are handled by your physical server:

http://www.aaa.com:8080/web1
http://www.bbb.com:8080/web2
http://www.ccc.com:8080/web3

The first URL is mapped to virtual server www.aaa.com, the second URL is mapped to virtual server www.bbb.com, and the third is mapped to virtual server www.ccc.com. For this mapping to work, www.aaa.com, www.bbb.com, and www.ccc.com must all resolve to your physical server’s IP address and each virtual server must be registered with the DNS server for your network.

By default, when Enterprise Server starts, the following virtual servers are started automatically:

The following tasks are used to administer virtual servers:

ProcedureTo Create a Virtual Server

The remote create-virtual-server command enables you to create the named virtual server.

Before You Begin

A virtual server must specify an existing HTTP listener. Because the virtual server cannot specify an HTTP listener that is already being used by another virtual server, create at least one HTTP listener before creating a new virtual server.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Create a virtual server by using the create-virtual-server(1) command.

  3. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 8–6 Creating a Virtual Server

The following example command creates a virtual server named sampleServer for hosts pigeon and localhost:


asadmin create-virtual-server --hosts pigeon,localhost sampleServer

Information similar to the following is displayed:


Command create-virtual-server executed successfully.

See Also

To see the full syntax and options of the command, type asadmin create-virutal-server --help at the command line.

ProcedureTo List Virtual Servers

The remote list-virtual-servers command enables you to list the existing virtual servers.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. List virtual servers by using the list-virtual-servers(1) command.


Example 8–7 Listing Virtual Servers

The following example command lists the virtual servers for localhost:


asaadmin list-virtual-servers

Information similar to the following is displayed:


sampleListener
admin-listener
http-listener-2
http-listener-1

Command list-http-listeners executed successfully.

See Also

To see the full syntax and options of the command, type asadmin list-virutal-servers --help at the command line.

ProcedureTo Delete a Virtual Server

The remote delete-virtual-server command enables you to delete an existing virtual server.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Obtain the exact name of the virtual server that you are deleting.

    To list the existing virtual servers:


    asadmin list-virtual-servers
    
  3. If necessary, notify users that the virtual server is being deleted.

  4. Delete a virtual server by using the delete-virtual-server(1) command.

  5. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 8–8 Deleting a Virtual Server

The following example command deletes the virtual server named sampleServer from localhost:


asadmin delete-virtual-server sampleServer

Information similar to the following is displayed:


Command delete-virtual-server executed successfully.

See Also

To see the full syntax and options of the command, type asadmin delete-virutal-server --help at the command line.