我正在尝试绑定别名来运行我的应用而不是服务器上的ip地址。所以我想访问我的应用程序helloworld.businessname.com:8555/helloworld而不是172.19.20.xxx:8555/helloworld我在WEB-INF下的项目中添加了一个jboss-web.xml
<jboss-web>
<virtual-host>helloworld.businessname.com</virtual-host>
</jboss-web>
我在standalone.xml中编辑了虚拟主机标签
<subsystem xmlns="urn:jboss:domain:web:1.1" native="false" default-virtual-server="default-host">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket- binding="https" enable-lookups="false" secure="true">
</connector>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
<virtual-server name="helloworld.businessname.com" default-web-module="helloworld">
<alias name="helloworld.businessname.com"/>
</virtual-server>
当我去helloworld.businessname.com:8555/它说找不到。
我很感激。
答案 0 :(得分:0)
standalone.xml没问题
将jboss-web.xml设置为:
<jboss-web>
<context-root>/</context-root>
<virtual-host>helloworld.businessname.com</virtual-host>
</jboss-web>
在服务器上设置主机文件(c:\ windows \ system32 \ drivers \ etc \ hosts或/ etc / hosts):
127.0.0.1 helloworld.businessname.com
将您的服务器运行为:
standalone.bat -b 0.0.0.0
并部署。