Virtual Hosting with Tomcat - JBoss

Virtual Hosting with Tomcat - JBoss

Add hosts and aliases to server.xml:

  • <Host name="myhost.com">
  • <Alias>www.myhost.com</Alias>

</Host>

Register applications for virtual hosts in their WEB-INF/jboss-web.xml files:

  • <jboss-web>
  • <context-root>/myapp</context-root>
  • <virtual-host>myhost.com</virtual-host>

</jboss-web>

Applications default to host specified by <Engine>'s defaultHost attribute

Learn the core features of JBOSS Traning and become master with our expertise tutorials.

server.xml

<Server>

<Service>

<Connector .../>

<Engine>

<Host name="myhost.com">

<Alias>www.myhost.com</Alias>

</Host>

<Host name="anotherhost.com"/>

</Engine>

</Service>

</Server>

myapp.war/WEB-INF/jboss-web.xml: 

<jboss-web>

<context-root>/myapp</context-root>

<virtual-host>myhost.com</virtual-host>

</jboss-web>

ROOT-another.war/WEB-INF/jboss-web.xml: 

<jboss-web>

<context-root>/</context-root>

<virtual-host>anotherhost.com</virtual-host>

</jboss-web>

For indepth understanding on JBoss click on: