Configure virtual hosts
Virtual hosts let you manage a single application server on a single machine as if the application server were multiple application servers each on their own host machine. We can separate and control which resources are available for client requests by combining multiple host machines into a single virtual host, or by assigning host machines to different virtual hosts.
If the external HTTP server configuration uses the default port, 9080, we do not have to perform these steps.
Virtual hosts isolate and independently manage multiple sets of resources on the same physical machine. Resources associated with one virtual host cannot share data with resources associated with another virtual host. This is true even though the virtual hosts share the same application server on the same physical machine.
For example, suppose that:
- An Internet service provider (ISP) has two customers with Internet sites hosted on the same machine. The ISP keeps the two sites isolated from one another, despite their sharing a machine, by using virtual hosts. The ISP associates the resources of the first company with VirtualHost1 and the resources of the second company with VirtualHost2. Both virtual hosts map to the same application server.
- Both company sites offer the same servlet. Each site has its own instance of the servlet, and is unaware of the same servlet on the other site. If the company whose site is organized on VirtualHost2 is past due in paying its account with the ISP, the ISP can refuse all servlet requests that are routed to VirtualHost2. Even though the same servlet is available on VirtualHost1, the requests directed at VirtualHost2 do not go to the other virtual host.
Because the servlet is associated with a virtual host instead of the actual DNS address, The servlet on virtual host VirtualHost1 does not share its context with the servlet that has the same name on virtual host VirtualHost2. Requests for the servlet on VirtualHost1 can continue as usual, even though VirtualHost2 is refusing to fill requests for the servlet with the same name.
If any of the following conditions exist, you must update the HTTP port numbers associated with the default virtual host. or define a new virtual host and associate it with the ports the HTTP server configuration uses:
- Your external HTTP server configuration uses a port other than the default port of 9080, define the port that you are using.
- We are using the default HTTP port 9080, but the port is no longer defined. We must define port 9080.
- You have created multiple application servers as either stand-alone servers or cluster members, and these servers use the same virtual host. Because each server must be listening on a different port, define a virtual host alias for the HTTP port of each server.
If we define new virtual host aliases, identify the port values that the aliases use on the Host alias settings page in the console.
To create a new virtual host or change the configuration of an existing virtual host.
- In the console, click Environment > Virtual hosts.
- Optional: Create a new virtual host. If we create a new virtual host, a default set of 90 MIME entries are automatically created for that virtual host.
- In the console, click New.
- Enter the name of the new virtual host and click OK. The new virtual host appears in the list of virtual hosts we can configure.
- Select the virtual host whose configuration to change.
- Under Additional Properties, click Host aliases.
- Create new host aliases or update existing host aliases to associate each of the HTTP port numbers with this virtual host.
There must be a virtual host alias corresponding to each port the HTTP server configuration uses. There is one HTTP port associated with each web container, and it is usually assigned to the virtual host named default_host. We can change the default assignment to any valid virtual host.
The host aliases associated with the default_host virtual host are set to * when you install the product. The * (an asterisk) indicates that the alias name does not have to be specified or that any name can be specified.
When the URL for the application is entered into a web browser, the port number is included. For example, if 9082 is the port number, the specified URL might look like the following:
http://localhost:9082/wlm/SimpleServlet
To create a new host alias:
To update an existing host alias:
- Click New.
- Specify a host alias name in the Host Name field and one of the HTTP ports in the Port field.
We can specify * (an asterisk) for the alias name if we do not want to require the specification of the alias name or to allow any name to be specified.
- Click OK and Save to save your configuration change.
- Select an existing host alias name.
- Change the value specified in the Port field to one of the HTTP ports.
- Click OK and Save to save your configuration change.
- Optional: Define a MIME object type and its file name extension if you require a MIME type other than the pre-defined types.
- For each needed MIME entry on the MIME type collection page, click New.
- On the MIME type settings page, specify a MIME type and extension.
- Click OK and Save to save the configuration change.
- Regenerate the web server plug-in configuration.
- Servers > Server Types > Web servers, then select the appropriate web server.
- Click Generate plug-in, then click Propagate plug-in.
- Restart the application server.
Subtopics
- Virtual hosts
A virtual host is a configuration entity that enables a single host machine to resemble multiple host machines. It maintains a list of MIME types that it processes. We can associate a virtual host to one or more Web modules, but we can associate each web module with one and only one virtual host. 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.
- Virtual host collection
Use this page to create and manage configurations that each let a single host machine resemble multiple host machines. Such configurations are known as virtual hosts.
Related concepts
Virtual hosts
Related tasks
Export enterprise applications