1 Reply Latest reply on Oct 7, 2011 2:32 AM by Marcio Dantas

    Configuring virtual hosts on JBoss 7

    Max Korn Newbie

      Hi all,

      I have an application running on JBoss 4.x which is configured to run virtual hosts. (The virtual hosts are contained in the Host section of server.xml and in jboss-web.xml).  How do I port this to JBoss 7 ? just adding the alias in the virtual-server section seem not to work.

             <virtual-server name="default-host" enable-welcome-root="true">
                       <alias name="localhost"/>
                       <alias name="myhost.com"/>
              </virtual-server>

      am I missing something in the virtual host configuration ?

      Thanks

      Max

        • 1. Re: Configuring virtual hosts on JBoss 7
          Marcio Dantas Newbie

          Hi,

           

          you have to create a new virtual-server element and point it to the war module you want to use.

          If you don't set the web-module, jboss will use the default ROOT.war.

           

          So, if your war file is nameOfWarModuleWithoutDotWar.war, your virtual server configuration will be like below.

           

              <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="virtualServerName">
                      <connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
                      <virtual-server name="virtualServerName" default-web-module="nameOfWarModuleWithoutDotWar">
                             <alias name="example.com"/>
                             <alias name="otherExample.com"/>
                       </virtual-server>
              </subsystem>