1 Reply Latest reply on Aug 17, 2005 2:27 AM by maheshkudva

    Multiple domain names (Virtual Domain names) on JBoss AS

    onyii5119

      Hi All,

      I have done an extensive research/search on the
      internet but did not get a suitable solution on how to
      configure multiple domain names (Virtual Domain names)
      on JBoss AS (running Tomcat) in a Linux environment. I
      do not want to use multiple IPs on the same server.

      Essentially, I have two domain names MyDomain1.com and
      MyDomain2.com. I want to be able to deploy different
      ear applications on the server so that clients of
      MyDomain1.com can enter http://www.MyDomain1.com in a
      browser and start Application1. Similarly, clients of
      MyDomain2.com can enter http://www.MyDomain2.com in a
      browser and start Application2. Application1 is
      completely independent of Application2 and belong to
      two different organizations.

      I have already set up a DNS server that resolves the
      two domains to the same Ip address.

      Has any body done anything like that? Is it even
      possible to do so in a JBoss (with Tomcat) AS?

      If you have a solution, kindly let me know how you did
      it or you could point me to a good reference document.

      I am using JBoss 4.0.2 and Fedora Linux kernel 2.4.26
      in a dedicated server hosted by an ISP.

      Thanks,

      Jonathan

        • 1. Re: Multiple domain names (Virtual Domain names) on JBoss AS
          maheshkudva

          Thanks to all.

          This setup has been tested on Apache2+JBoss+mod_jk-1.2.14_for MacOSX. And am sure it will work on other platforms as well. This setup also handles Apache related webapps..

          Make the required entries in the DNS

          webapp.war: Extract the war file using zip and rename the folder
          with .war extension. Please put it in your deployment folder.

          mod-jk.so: Obtain the modjk.so library file from www.apache.org and place then in the modules folder.

          Apache-Virtual Host config
          ----------------------

          NameVirtualHost *.*.*.*:80
          
          <VirtualHost *.*.*.*:80>
           ServerName webapp.robosoft.co.in
           ServerAlias www.webapp.robosoft.co.in
           ServerAdmin root@localhost
           DocumentRoot /Volumes/Extra/jboss/server/default/deploy/webapp.war
           JkMount /* loadbalancer
           DirectoryIndex index.html index.jsp
           ErrorLog logs/webapp-error_log
           CustomLog logs/webapp-access_log common
          </VirtualHost>
          

          -------------------------------------------------------------------------
          mod-jk.conf
          ================
          LoadModule jk_module /opt/apache2/modules/mod_jk.so
          
          JkWorkersFile /opt/apache2/conf/workers.properties
          JkLogFile /opt/apache2/logs/mod_jk.log
          JkLogLevel info
          JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
          JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
          JkRequestLogFormat "%w %V %T"
          JkMount /webapp.domain.com/*.jsp loadbalancer
          JkMountFile /opt/apache2/conf/uriworkermap.properties
          JkShmFile /opt/apache2/logs/jk.shm
          <Location /jkstatus/>
           JkMount status
           Allow from all
          </Location>
          

          --------------------------------------------------------------------------
          Server.xml
          ---------

          <Host name="webapp.domain.com" debug="0" appBase="deploy"
          unpackWARs="true">
           <Alias>www.webapp.domain.com</Alias>
           <Logger className="org.apache.catalina.logger.FileLogger"
           directory="logs" prefix="webapp_log1." suffix=".log"
          timestamp="true"/>
           <Context path=""
          docBase="${jboss.server.home.dir}/deploy/webapp.war" debug="0"
          reloadable="true"/>
           </Host>
          

          --------------------------------------------------------------------------
          --
          uriworkermap.properties
          ================
          /jmx-console=loadbalancer
          /jmx-console/*=loadbalancer
          /web-console=loadbalancer
          /web-console/*=loadbalancer
          /webapp.domain.com/*.jsp
          

          --------------------------------------------------------------------------
          --
          workers.properties
          ================
          worker.list=loadbalancer,status
          
          worker.webapp.port=8009
          worker.webapp.host=webapp.domain.com
          worker.webapp.type=ajp13
          worker.webapp.lbfactor=1
          worker.webapp.cachesize=10
          
          worker.loadbalancer.type=lb
          worker.loadbalancer.balance_workers=library
          worker.loadbalancer.sticky_session=1
          worker.loadbalancer.local_worker_only=1
          worker.list=loadbalancer
          
          worker.status.type=status
          


          Regards & Thanks
          ================
          Mahesh S Kudva
          Network Analyst
          Robosoft Technologies