Virtual hosts

The Web containers handle traffic for the Web modules contained within them. WebSphere uses virtual hosts as filters for the traffic coming in from the Web. A virtual host is a configuration enabling a single host machine to resemble multiple host machines. Resources associated with one virtual host cannot share data with resources associated with another virtual host, even if the virtual hosts share the same physical machine.

Each virtual host has a logical name and a list of one or more DNS aliases by which it is known. A DNS alias is the TCP/IP host name and port number used to request the servlet, for example yourHostName:80. When no port number is specified, 80 is assumed as the default.

When a servlet request is made, the server name and port number entered into the browser are compared to a list of all known aliases in an effort to locate the correct virtual host and serve the servlet. If no match is found, an error is returned to the browser.

A virtual host is not associated with a particular node (machine). It is a configuration, rather than a "live object," explaining why it can be created, but not started or stopped.

For many users, virtual host creation is unnecessary because, by default, WAS V5 provides two virtual hosts:

  1. The default_host, which is used for accessing most applications

  2. The admin_host, which is configured for accessing the Administrative Console (while other applications are not accessible through this virtual host)

The default settings for default_host map to all requests for any alias on ports 80, 9443, and 9080. The default settings for admin_host map to requests on ports 9090 and 9043.

The virtual host definition is a list of hosts and ports on which a Web module will accept traffic. As shown in Figure 5-3, the PluginVirtualHost virtual host uses a wildcard (*) to allow traffic from all hosts on 9088, and hosts edge, web1, and web2 on port 80. The settings for virtual host aliases can be found in the Administrative Console by clicking...

Environment | Virtual Hosts | <Virtual_Host_Name> | Host Aliases

Figure 5-3 The virtual host setup

It is recommended that you specify exactly the hosts and ports for your Web container, removing wildcard settings. Removing the wildcards will prevent any Web server redirecting traffic to your Web containers.

Virtual hosts are especially useful when setting up multiple appservers that use the same URI. Virtual host filtering can be used so that the request www.vhost1.com/snoop and www.vhost2.com/snoop can be handled by two different Web modules.

For in-depth information about configuring virtual hosts, see Chapter 12, "Configuring the Environment" of the redbook IBM WebSphere Version 5.0 System Management and Configuration, SG24-6195. When setting up extra virtual hosts, it is important to make sure that each contains a completely unique host name and port number entries. If there are wildcards or the same host name is listed in more than one virtual host, then the appserver will not be able to resolve requests and an error will occur that can be viewed in the WebSphere Administrative Console.

The error that will be seen is:

PLGN0021E: Servlet Request Processor Exception: Virtual Host/WebGroup Not Found : The web group /xx has not been defined

This is a generic error message and it can mean a number of things, but if you are positive the server is running, then check the virtual hosts.

  Prev | Home | Next

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.