简体   繁体   中英

How to set IBM Websphere 8 to serve web applications on different ports?

I need to deploy two applications as WAR files on Websphere. Both of them will require only HTTPS access.

Is it possible to run these two web applications on separate ports on same Websphere instance?

For example, will it be possible to access two applications like this:

https://192.101.1.101:7070/WebApplication1/ 

and

https://192.101.1.101:7080/WebApplication2/ 

(Same IP, same protocol(https), different ports)

Yes, (on WebSphere Application Server V8.5.5) and here is an example of how to do it:

<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" />
<httpEndpoint id="localHostOnly" host="localhost" httpPort="9081" />

<virtualHost id="alice">
     <hostAlias>your_host_name:9080</hostAlias>
</virtualHost>

<virtualHost id="bob">
     <hostAlias>localhost:9081</hostAlias>
</virtualHost>

<application id="App1" location="myApp.ear" name="App1"
type="ear"/>
<application id="App2" location="myApp2.war" name="App2"
type="war"/>

From IBM:

The defaultHttpEndpoint exposes all interfaces on port 9080, the http endpoint with id="localHostOnly" specifies host="localhost", meaning that port 9081 is only exposed on the localhost interface.

If App1 has a WAR file with an ibm-web.bnd.xml file specifying <virtual-host name="alice"/> then this application can only be accessed at your_host_name:9080/app1_context_root.

If App2 (which is a WAR) has an ibm-web-bnd.xml file specifying <virtual-host name="bob"/> then this application can only be accessed at localhost:9081/app2_context_root.

If a third application were deployed which specified no specific virtual host, that application in this configuration would be available on all interfaces of the defaultHttpEndpoint on port 9080, excluding your_host_name:9080 - for example it could be accessed on localhost:9080/app3_context_root.

For more info see the closing text on this APAR: http://www-01.ibm.com/support/docview.wss?uid=swg1PM97514

After some analysis I came to the below conclusion.

  1. Each application server in WAS listens only on one port per protocol.
  2. In WAS 8 ND, there is an option to create multiple application servers. (In the application servers tab, the 'New...' option is available only in WAS ND).
  3. In WAS 8 Standalone server, the option to have multiple application servers is not available.
  4. There seems to be a way to use transport chains to make the server listen to same protocol on another port as well, but the purpose is not to make one webapp available on each port. The purpose is to just route a secondary port to the base port for that protocol.
  5. Even in WAS 8 standalone, there seem to be some scripting hack that can allow another server to be created. But I am not sure if license supports such usage.
  6. Finally, the way to make two different applications on a single WAS 8 standalone server available on different ports is to route the requests through two Web servers (reverse-proxy servers) (one per web application), and connect those web servers to WAS through WAS Web server plugins.
  7. It is after the proxy routing that virtual hosts can be used to filter which reverse-proxy can communicate with which web application.

To sum it up:

In case of WAS 8 standalone, web servers need to be used as reverse proxies. Forwarded requests from those reverse proxies can be filtered in WAS so that specific webapps are mapped to specific virtual hosts.

IBM WAS Standalone server allows creation of multiple profiles on same server using Profile Management Tool. It is almost like there are two IBM installations on the same server.

There are two Windows processes one for each profile. And the entire set of ports are incremented automatically making them as two different app server instances. Its easy to manage both using the Profile management tool. Also, they have separate consoles where settings can be adjusted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM