8 Replies Latest reply on May 4, 2017 5:59 AM by nurubhas s

    How we can configure multiple HTTP ports in Jboss standalone ?

    nurubhas s Newbie

      Hi All,

       

      I have a small requirement, I am looking to run & access my applications with different port in standalone environment. Is it possible ?

       

      Let say :

       

      I have configured Jboss EAP 6.4 in standalone mode & I have deployed two applications (one is for development & another one is testing )... & both apps should run with unique port.

       

      how we can ?

       

      Thanks

      Nurubhas

        • 1. Re: How we can configure multiple HTTP ports in Jboss standalone ?
          Panagiotis Chavariotis Novice

          You can do this by creating the appropriate:

          • socket-bindings
          • connectors
          • virtual-servers

          Additionally, you have to update accordingly each application's jboss-web.xml file with the right virtual host name (the one created previously).

          1 of 1 people found this helpful
          • 2. Re: How we can configure multiple HTTP ports in Jboss standalone ?
            nurubhas s Newbie

            Hi Chavariotis,

             

            Thanks for reply.. can you please give some examples.

             

            I thought in EAP 6... standalone.xml file having standard sockets... how we can add multiple socket groups.

             

            Thanks

            Nurubhas

            • 3. Re: How we can configure multiple HTTP ports in Jboss standalone ?
              Panagiotis Chavariotis Novice

              First, update the standalone.xml and add socket-binding for a NEW port (for example 8282):

              <socket-binding name="http2" port="8282"/>

               

              Then, in the web subsystem add the new connector:

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

               

              Then, you must add two discrete virtual-servers in web subsystem for each application (Dev.war & Test.war) as follows:

              <virtual-server name="host1" enable-welcome-root="false" default-web-module="Dev.war">

                <alias name="dev.com"/>             

              </virtual-server>

               

              <virtual-server name="host2" enable-welcome-root="false" default-web-module="Test.war">

                <alias name="test.com"/>          

              </virtual-server>

               

              And finally, define virtual-servers in the respective connectors:

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

                       <virtual-server name="host1"/>

              </connector>

               

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

                       <virtual-server name="host2"/>

              </connector>

               

              As a last step, don't forget to add a jboss-web.xml in WEB-INF of each application:

              - For Dev.war

              <jboss-web>

                      <virtual-host>host1</virtual-host>

              </jboss-web>

               

              - For Test.war

              <jboss-web>

                      <virtual-host>host2</virtual-host>

              </jboss-web>

               

              As a result of the above changes, you can access your application via the following URLs:

              For Dev.war - http://dev.com:8080/Dev/index.jsp

              For Test.war - http://test.com:8282/Test/index.jsp

              1 of 1 people found this helpful
              • 4. Re: How we can configure multiple HTTP ports in Jboss standalone ?
                nurubhas s Newbie

                Hi Panagiotis,

                 

                Seems to be excellent configuration, I will check & ping you back.

                 

                if i need any help.

                 

                Thanks

                Nurubhas

                • 5. Re: How we can configure multiple HTTP ports in Jboss standalone ?
                  nurubhas s Newbie

                  Hi Chavariotis,

                   

                  As you said, I have configured the socket binding & virtual servers.. seems to be be everything ok, but I am not able to access the any application.

                  I am sharing the web subsystem.. can you please help me here.

                   

                  What other things need to configure here.

                   

                   

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

                          <subsystem xmlns="urn:jboss:domain:web:2.1" native="false">

                          

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

                                  <virtual-server name="Host1"/>

                              </connector>

                   

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

                                  <virtual-server name="Host2"/>

                              </connector>

                   

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

                              <alias name="localhost"/>

                              <alias name="example.com"/>

                              </virtual-server>

                   

                              <virtual-server name="Host1" enable-welcome-root="false" default-web-module="version.war">

                                  <alias name="version"/>

                                  <alias name="version.com"/>

                              </virtual-server>

                   

                              <virtual-server name="Host2" enable-welcome-root="false" default-web-module="version2.war">

                                  <alias name="version2"/>

                                  <alias name="version2.com"/>

                              </virtual-server>

                   

                          </subsystem>

                   

                  Socket binding configuration;

                   

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

                          <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>

                          <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

                          <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>

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

                          <socket-binding name="http" port="8080"/>

                           <socket-binding name="http2" port="8282"/>

                          <socket-binding name="https" port="8443"/>

                          <socket-binding name="remoting" port="4447"/>

                          <socket-binding name="txn-recovery-environment" port="4712"/>

                          <socket-binding name="txn-status-manager" port="4713"/>

                          <outbound-socket-binding name="mail-smtp">

                              <remote-destination host="localhost" port="25"/>

                          </outbound-socket-binding>

                      </socket-binding-group>

                   

                  From war file side, I have created a jboss-web.xml configuration

                   

                  version.war

                  =========== jboss-web.xml

                   

                  <jboss-web>

                    <virtual-host>Host1</virtual-host>

                  </jboss-web>

                   

                  version2.war

                  =========== jboss-web.xml

                   

                  <jboss-web>

                    <virtual-host>Host2</virtual-host>

                  </jboss-web>

                  • 6. Re: How we can configure multiple HTTP ports in Jboss standalone ?
                    nurubhas s Newbie

                    Hi Chavariotis,

                     

                    As you said, I have configured the socket binding & virtual servers.. seems to be be everything ok, but I am not able to access the any application.

                    I am sharing the web subsystem.. can you please help me here.

                     

                    What other things need to configure here.

                     

                     

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

                            <subsystem xmlns="urn:jboss:domain:web:2.1" native="false">

                            

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

                                    <virtual-server name="Host1"/>

                                </connector>

                     

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

                                    <virtual-server name="Host2"/>

                                </connector>

                     

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

                                <alias name="localhost"/>

                                <alias name="example.com"/>

                                </virtual-server>

                     

                                <virtual-server name="Host1" enable-welcome-root="false" default-web-module="version.war">

                                    <alias name="version"/>

                                    <alias name="version.com"/>

                                </virtual-server>

                     

                                <virtual-server name="Host2" enable-welcome-root="false" default-web-module="version2.war">

                                    <alias name="version2"/>

                                    <alias name="version2.com"/>

                                </virtual-server>

                     

                            </subsystem>

                     

                    Socket binding configuration;

                     

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

                            <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>

                            <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

                            <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>

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

                            <socket-binding name="http" port="8080"/>

                             <socket-binding name="http2" port="8282"/>

                            <socket-binding name="https" port="8443"/>

                            <socket-binding name="remoting" port="4447"/>

                            <socket-binding name="txn-recovery-environment" port="4712"/>

                            <socket-binding name="txn-status-manager" port="4713"/>

                            <outbound-socket-binding name="mail-smtp">

                                <remote-destination host="localhost" port="25"/>

                            </outbound-socket-binding>

                        </socket-binding-group>

                     

                    From war file side, I have created a jboss-web.xml configuration

                     

                    version.war

                    =========== jboss-web.xml

                     

                    <jboss-web>

                      <virtual-host>Host1</virtual-host>

                    </jboss-web>

                     

                    version2.war

                    =========== jboss-web.xml

                     

                    <jboss-web>

                      <virtual-host>Host2</virtual-host>

                    </jboss-web>

                    • 7. Re: How we can configure multiple HTTP ports in Jboss standalone ?
                      Priyanka Tyagi Newbie

                      You may need to add version.com and version2.com in /etc/hosts of system.


                      • 8. Re: How we can configure multiple HTTP ports in Jboss standalone ?
                        nurubhas s Newbie

                        ok, I will try to add these in hosts.