Sun GlassFish Enterprise Server 2.1 Administration Guide

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 Internet Protocol (IP) address of that physical server. A virtual server associates a domain name for a server (such as with the particular server on which the Enterprise Server is running.

Note –

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

For instance, assume you want to host these domains on your physical server:

Assume also that,, and have web modules web1, web2, and web3, respectively, associated with them.

This means that all of these URLs are handled by your physical server:

The first URL is mapped to virtual host, the second URL is mapped to virtual host, and the third is mapped to virtual host

On the other hand, the following URL results in a 404 return code, because web3 isn’t registered with

For this mapping to work, make sure that,, and all resolve to your physical server’s IP address. They need to be registered with the DNS server for your network. In addition, on a UNIX system, add these domains to your /etc/hosts file (if the setting for hosts in your /etc/nsswitch.conf file includes files).

When the Enterprise Server is started, it starts the following virtual servers automatically:

For development, testing, and deployment of web services in a non-production environment, server is often the only virtual server required. In a production environment, additional virtual servers provide hosting facilities for users and customers so that each appears to have its own web server, even though there is only one physical server.