gpt4 book ai didi

tomcat - 在同一个 jboss-4.0.3 中部署两个具有不同域名但相同上下文路径的 war

转载 作者:行者123 更新时间:2023-11-28 22:18:55 25 4
gpt4 key购买 nike

我有两个 Web 应用程序 war STORE_ABC.warSTORE_DEF.war 以及在我的机器上运行的单个 JBoss 服务器。我想在我的 jboss 中部署具有相同上下文路径的两场 war ,如下所示。

http://localhost:8080/home 对于 STORE_ABC.war

http://testsite1:8080/home 对于STORE_DEF.war

jboss-web.xml 用于 STORE_ABC.warSTORE_DEF.war

<jboss-web>
<context-root>/</context-root>
</jboss-web>

如何实现上述配置?

最佳答案

我添加了另一个主机vhost2server.xml内部文件夹 ${jboss-home}server\default\deploy\jbossweb-tomcat55.sar文件夹如下:

<Server>
<Service name="jboss.web"
className="org.jboss.web.tomcat.tc5.StandardService">
<Connector port="8080" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>

<Connector protocol="HTTP/1.1" port="8081" address="${jboss.bind.address}"
redirectPort="${jboss.web.https.port}" />


<Connector port="8089" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="443"
protocol="AJP/1.3"/>

<Connector port="8445" address="${jboss.bind.address}"
maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
scheme="https" secure="true" clientAuth="false"
keystoreFile="${jboss.server.home.dir}/conf/bookstore.keystore"
keystorePass="bookstore" sslProtocol = "TLS" allowTrace="true"/>

<Engine name="jboss.web" defaultHost="localhost">
<Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm"
certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
/>
<Host name="localhost"
autoDeploy="false" deployOnStartup="false" deployXML="false">
</Host>
<Host name="vhost2" autoDeploy="false"
deployOnStartup="false" deployXML="false">
<Alias>testsite1</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="vhost2" suffix=".log" pattern="common"
directory="${jboss.server.home.dir}/log"/>
<DefaultContext cookies="true" crossContext="true" override="true"/>
</Host>
</Engine>
</Service>
</Server>

然后我添加了一个新文件jboss-web.xmlSTORE-DEF.war里面WEB-INF文件夹如下:

<jboss-web>
<context-root>/</context-root>
<virtual-host>testsite1</virtual-host>
</jboss-web>

现在我可以访问 STORE-ABC.war来自网址 http://localhost:8080/homeSTORE-DEF.war来自网址 http://testsite1:8080/home .

注意 - 不要忘记添加 127.0.0.1 testsite1hosts文件。

关于tomcat - 在同一个 jboss-4.0.3 中部署两个具有不同域名但相同上下文路径的 war ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30772012/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com