WAS v8.5 > Set up the application serving environment > Administer application servers > Configure virtual hosts
Virtual hosts
A virtual host is a configuration entity that enables a single host machine to resemble multiple host machines. Resources associated with a virtual host are not shared with other virtual hosts. Each virtual host has a DNS alias composed of the hostname and port number used to request the servlet. For example...
hostname:portnumber
The DNS alias in a client request is compared to the list of DNS aliases defined in virtual host groups. The URI is compared to the list of all URI groups. If both are found, the request is sent to the corresponding server group for processing and a response is returned to browser. If not found, a 404 not found error is returned to the browser.
Application deployment associates an application with a virtual host. Virtual host definitions associate the network address of the machine and the HTTP transport or web server port assignment of the application server with the virtual host.
Requests to virtual host groups on application servers can come from a variety of web clients, including browsers, curl, wget, or web servers via their plugin. For example...
- The web client asks for...
http://www.myhost.com:10039/wps/portal/myportlet
- The myhost machine has the 10039 port assigned to the application server WebSphere_Portal.
- WebSphere_Portal looks at the virtual host assignments to determine the virtual host is assigned to the alias...
myhost.com:10039
- The application server finds no explicit alias for that DNS string exists. However, a wild card assignment does exist for...
*:10039
This is a match. The virtual host that defines the match is default_host.
- The application server looks at the applications deployed on the default_host and finds appropriate web application.
- The application server serves the application to the web client and the requester.
A problem can occur if we use the same alias for two different virtual hosts. For example, assume that you installed the default application and the snoop servlet on the default_host. You also have another virtual host called the admin_host. However, we have not installed the default application or the snoop servlet on the admin_host.
Virtual host Alias Port default_host * 9080 localhost 9080 admin_host * 9060 my_machine.com 9080 Assume that a web client request comes in for...
http://my_machine.com:9080/snoop
If the application server matches the request against *:9080, the application is served from the default_host. If the application server matches the request to my.machine.com:9080, the application cannot be found. A 404 error occurs in the browser that issues the request. A message states the virtual host could not be found.
This problem is the result of not finding the requested application in the first virtual host that has a matching alias. The correct way to code aliases is for the alias name on an incoming request to match only one virtual host in all of your virtual host definitions. If the URL can match more than one virtual host, we can see the problem just described.
Adding localhost to the virtual hosts adds allows a remote user to access the dmgr console.
If you make changes to virtual host groups, regenerate the web server plug-in configuration. We can use the dmgr console to initiate the plug-in regeneration.
Related
Configure virtual hosts