使用WildFly托管多个域(Undertow) [英] Hosting multiple domains with WildFly (Undertow)

查看:128
本文介绍了使用WildFly托管多个域(Undertow)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有两个域( app1.com app2.com )和两个耳朵( app1.ear app2.ear )。每个EAR文件都包含ejb.jar和web.war。此外,每个WAR都有上下文根: / app1 / app2



因此,如果我启动WildFly,我将拥有两个应用程序在 localhost:8080 / app1 localhost:8080 / app2 上运行。



我如何绑定 app1.com localhost:8080 / app1 app2.com localhost:8080 / app2



据我所知,我应该在standalone.xml中修改Undertow子系统配置。我试过了:

 < server name =default-server> 
< http-listener name =defaultsocket-binding =http/>
< host name =app1.comdefault-web-module =app1.ear / web.war/>
< host name =app2.comdefault-web-module =app2.ear / web.war/>
< / server>

但它不起作用。

解决方案

添加内容

 < jboss-web> 
< context-root> app1< / context-root>
< virtual-host> app1.com< / virtual-host>
< / jboss-web>

和第二次战争类似。


For example I have two domains (app1.com, app2.com) and two ears (app1.ear, app2.ear). Each EAR file consists of ejb.jar and web.war. Also each WAR has context root: /app1 or /app2.

So if I start WildFly I will have two applications running on localhost:8080/app1 and localhost:8080/app2.

How I can bind app1.com to localhost:8080/app1 and app2.com to localhost:8080/app2?

As I understand, I should modify Undertow subsystem configuration in standalone.xml. I tried:

<server name="default-server">
    <http-listener name="default" socket-binding="http"/>
    <host name="app1.com" default-web-module="app1.ear/web.war"/>
    <host name="app2.com" default-web-module="app2.ear/web.war"/>
</server>

but it's doesn't work.

解决方案

Add WEB-INF/jboss-web.xml

with contents

<jboss-web>
  <context-root>app1</context-root>
  <virtual-host>app1.com</virtual-host>
</jboss-web>

and similarly for second war.

这篇关于使用WildFly托管多个域(Undertow)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆