3 Replies Latest reply on Jul 24, 2012 11:13 PM by davidintx

    JBoss AS 7.1 - Multiple virtual servers with mod_jk

    Werner Gaulke Newbie

      Hello,

       

      i am currently stuck in a configuration problem with JBoss AS 7.1.1 together with Apache 2.2 and mod_jk 1.2.32.

       

      I closely followed https://docs.jboss.org/author/display/AS71/AJP+Connectors  - but I have serious trouble getting multiple vhosts to work.

      My mod_jk / AJP configuration is correct, if I use only the default virtual hosts.

       

      What I want: I have multiple domains and applications and want to use mod_jk to map the domains to a jboss virtual server.

       

      Some configuration details:

      workers.properties:

      {noformat}

      worker.list=node1,node2,status

       

      worker.node1.port=8009

      worker.node1.host=localhost

      worker.node1.type=ajp13

       

      worker.node2.port=8009

      worker.node2.host=test.com

      worker.node2.type=ajp13

      {noformat}

       

       

      standalone.xml

      {noformat}

      <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">

                  <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                  <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>

                  <virtual-server name="default-host" enable-welcome-root="true">

                      <alias name="localhost"/>

                  </virtual-server>

                  <virtual-server name="test.com" default-web-module="myWarfile" />

      </subsystem>

       

      ...

      <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

                 <socket-binding name="ajp" port="8009"/>

      ...

      {noformat}

       

       

       

      What works: The domain configured for node1 successfully conntects to the default-host. All applications are available through their path. For example node1domain.com/myWarfile

      What doesn't work: The domain configured for node2 returns always a 502 - bad gateway. The mod_jk log gives me: (node2) connecting to tomcat failed.

       

       

      I am really clueless how to solve this problem - does someone here have an idea? Did I miss something in the documentation?

        • 1. Re: JBoss AS 7.1 - Multiple virtual servers with mod_jk
          Werner Gaulke Newbie

          Some update on the issue. I tried a few more things:

           

           

          1. Add a jboss-web.xml with the following content:

           

          {noformat}

          <jboss-web>

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

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

          </jboss-web>

          {noformat}

           

          Which did not have any impact.

           

           

          2. Upgrade mod_jk to the recently release 1.2.36 -> no success either. With 1.2.36 the whole connection for jboss seems not to work.

           

           

           

          Any more tipps or advice? Does no one use jboss in production - maybe I should try mod_cluster?

          • 2. Re: JBoss AS 7.1 - Multiple virtual servers with mod_jk
            Werner Gaulke Newbie

            Despite the overwhelming community feedback I found a solution.

             

            For the record and good will of sharing:

             

            My config:

            JBossAS 7.1.2 Tag (self compiled)

            HTTPD 2.22

            Mod_jk 1.2.32

             

             

            Apache config:

            {noformat}

            <VirtualHost *:80>

              ServerName test.com

              JkMount /* node1

            </VirtualHost>

            <VirtualHost *:80>

              ServerName another-host.com

              JkMount /* node1

            </VirtualHost>

            {noformat}

             

             

            Workers.properties:

            {noformat}

            worker.list=node1

             

            worker.node1.port=8009

            worker.node1.host=localhost

            worker.node1.type=ajp13

            {noformat}

             

            Jboss Config:

            {noformat}

                 <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false" instance-id="node1">

                        <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                        <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>

                        <virtual-server name="default-host" enable-welcome-root="false">

                            <alias name="localhost"/>

                            <alias name="another-host.com" />

                        </virtual-server>

                        <virtual-server name="test.com">    

                        </virtual-server>           

                    </subsystem>

            ...

                 <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

                      ...

                    <socket-binding name="ajp" port="8009"/>

                      ...

                 </socket-binding-group>

            {noformat}

             

            Jboss-web.xml:

            {noformat}

            <jboss-web>

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

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

            </jboss-web>

            {noformat}

             

             

             

            One remark: it did not work with mod_jk 1.2.36. Also I did not try mod_cluster and have yet not configured SSL.

             

            Maybe someone on this board is willing to share his multidomain configuration - no matter of mod_jk or mod_cluster.

            1 of 1 people found this helpful
            • 3. Re: JBoss AS 7.1 - Multiple virtual servers with mod_jk
              davidintx Newbie

              Thanks for posting that, it saved me a lot of time.  One modification I made to get it to work for me was that I needed to set the default-web-module in the default virtual server.  Also, I can confirm that this worked just fine with ssl.  In my case, I had one site domain served with ssl and another without, going to different jboss virtual hosts, and it all worked fine.