我需要在 Websphere 上将两个应用程序部署为 WAR 文件。 它们都只需要 HTTPS 访问。
是否可以在同一 Websphere 实例上的不同端口上运行这两个 Web 应用程序?
例如,是否可以像这样访问两个应用程序:
https://192.101.1.101:7070/WebApplication1/
和
https://192.101.1.101:7080/WebApplication2/
(相同IP,相同协议(protocol)(https),不同端口)
最佳答案
是的,(在 WebSphere Application Server V8.5.5 上),下面是如何执行此操作的示例:
<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"/>
来自 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.
有关更多信息,请参阅此 APAR 的结束文本: http://www-01.ibm.com/support/docview.wss?uid=swg1PM97514
关于web-applications - 如何设置 IBM Websphere 8 在不同端口上为 Web 应用程序提供服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26143263/