1 Reply Latest reply on Aug 17, 2005 2:26 AM by Mahesh Kudva

    Virtual Host Question...again

    Dan Lodge Newbie

      Hello, I am seeking advice on how to change the virtual host setting for my installation. Judging from responses to similar questions, I sense that the veterans are getting rather bored with this theme from newbees. Nevertheless, I will ask it again.

      Currently, I call my application using the following current url syntax, whereas I would like to change it to the desired url syntax.

      Current url: http://mylaptop:1977/myapp/mymainmenu.jsp
      Desired url: http://myapp/ mymainmenu.jsp

      Naturally, I have read the manual, and have tried to reproduce the example in ADMINGUIDE.PDF, Page 325/6 (Section 9.6: Setting up Virtual Hosts). Further, I have searched this forum and have come across various questions similar to mine with similar suggestions. However, I have not been able to succeed (404 errors for example). One thing that is unique about my installation is that I found that the default HTTP port of 8080 conflicts with the TSNLISTENER for ORACLE which is also running on my laptop. Therefore, I have changed this port (from 8080 to 1977) according to the server.xml file attached.

      Before making any further changes, I would like to ask if there is any thing that I have missed in my setup or if there are other suggestions for further changes? For example, are there any other changes that are needed to coincide with the HTTP port change?

      ***********************************************************************
      1. jboss-web.xml

      <jboss-web>
      <!-- Uncomment the security-domain to enable security. You will
      need to edit the htmladaptor login configuration to setup the
      login modules used to authentication users.
      <security-domain>java:/jaas/jmx-console</security-domain>
      -->
      <context-root>/</context-root>
      <virtual-host>myapp.com</virtual-host>
      </jboss-web>

      2. server.xml



      <!-- A HTTP/1.1 Connector on port 8080 -->
      <!-- A HTTP Connector on port 8080 DML Change to 1977 -->


      <!-- A AJP 1.3 Connector on port 8009 -->


      <!-- SSL/TLS Connector configuration using the admin devl guide keystore

      -->



      <!-- The JAAS based authentication and authorization realm implementation
      that is compatible with the jboss 3.2.x realm implementation.
      - certificatePrincipal : the class name of the
      org.jboss.security.auth.certs.CertificatePrincipal impl
      used for mapping X509[] cert chains to a Princpal.
      -->

      <!-- A subclass of JBossSecurityMgrRealm that uses the authentication
      behavior of JBossSecurityMgrRealm, but overrides the authorization
      checks to use JACC permissions with the current java.security.Policy
      to determine authorized access.

      -->


      autoDeploy="false" deployOnStartup="false" deployXML="false">
      myapp.com

        • 1. Re: Virtual Host Question...again
          Mahesh Kudva Newbie

          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