在WEN-INF中新增文件 jboss-web.xml
内容如下:
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<!-- For context -->
<context-root>/</context-root>
<!-- For session copy -->
<replication-config>
<cache-name>standard-session-cache</cache-name>
</replication-config>
<!-- For session time -->
<max-active-sessions>20</max-active-sessions>
<passivation-config>
<use-session-passivation>true</use-session-passivation>
<passivation-min-idle-time>60</passivation-min-idle-time>
<passivation-max-idle-time>600</passivation-max-idle-time>
</passivation-config>
</jboss-web>
修改${JBOSS_HOME}/standalone/configuration/standalone.xml 文件
找到 <subsystem xmlns="urn:jboss:domain:web:1.1" 节点
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="xxx.com" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
<virtual-server name="xxx.com" enable-welcome-root="false" default-web-module="xxx.war">
<alias name="www.xxx.com"/>
</virtual-server>
</subsystem>
修改default-virtual-server的值为你新配置虚拟主机的name,由于jboss-web.xml配置了<context-root>/</context-root>,所以这里yecent.com中应配置enable-welcome-root="false",以使用xxx.war项目的主页作为服务器欢迎页。
最后修改host文件,以standalone.bat启动JBoss服务器即可通过www.xxx.com访问了