Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Open server.xml for editing (/path/to/your/apache-tomcat/conf/server.xml)
  • Comment out the default connector as shown below:

    No Format
    
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080
    <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/> -->
    
  • Now, uncomment the following connector block (You may adjust the port if you wish)

    No Format
    
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" address="127.0.0.1"
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    

...

mod_proxy_ajp is an extension of Apache mod_proxy that implements the AJP protocol. It is bundled with Apache httpd Server 2.2 and later and can be added to your server instance by adding the following options to your configure invocation:

No Format

--enable-proxy --enable-proxy-ajp

...

  • Navigate to your Apache config directory

    No Format
    
    cd /path/to/apache/config
    
  • Open httpd.conf for editing and locate the LoadModule section and make sure you have the mod_jk path defined (path may vary).

    No Format
    
    LoadModule jk_module "/usr/lib/httpd/modules/mod_jk.so"
    
  • In the same file, httpd.conf, define the IfModule directive

    No Format
    
    <IfModule mod_jk.c>
      JkWorkersFile "/path/to/apache/config/workers.properties"
      JkLogFile "/path/to/apache/logs/mod_jk.log"
      JkLogLevel debug
      JkMount /*.jsp worker1
      JkMount /path/to/portal/* worker1
    </IfModule>
    JkMountCopy All
    
  • Now, we need to configure the workers.properties file ( You may include the workers.properties file in the Apache config directory, but the path must match with the httpd.conf file where you defined the JkWorkersFile path above.)

    No Format
    
    #Below is an example of a workers.properties file.
    # Define 1 real worker using ajp13
    worker.list=worker1
    
    # Set properties for worker1 (ajp13)
    worker.worker1.type=ajp13
    # Set host to match the same value you used above for the 'address' attribute for your AJP Connector
    worker.worker1.host=127.0.0.1
    # Set the port to match the same value you used above for the 'port' attribute for your AJP Connector
    worker.worker1.port=8009
    
    # Below may vary as these are just examples of what can be included.
    worker.worker1.lbfactor=50
    worker.worker1.cachesize=10
    worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.socket_timeout=300
    
    #Below is an example of a workers.properties file.
    # Define 1 real worker using ajp13
    worker.list=worker1
    
    # Set properties for worker1 (ajp13)
    

...

       Option #2 mod_proxy/mod_proxy_ajp
  • After you have configured Tomcat in Step 1 you will now need to go to your Apache config directory to setup mod_proxy

    No Format
    
    cd /path/to/apache/config
    
  • Open httpd.conf for editing and uncomment the following modules

    No Format
    
    LoadModule proxy_module       /usr/lib/apache2-prefork/mod_proxy.so       #file path to the mod_proxy.so and mod_proxy_ajp.so may vary
    LoadModule proxy_ajp_module   /usr/lib/apache2-prefork/mod_proxy_ajp.so
    
  • You may chose to keep mod_proxy_ajp configurations separate by creating a new file (i.e., mod_proxy_ajp.conf), but you will need to map this path in your httpd.conf file

    No Format
    
    Include /path/to/apache/stuff/mod_proxy_ajp.conf
    
  • Whether you place your mod_proxy_ajp configurations in a separate file or in the httpd.conf is entirely up to you, but you will need to include the following information.

    No Format
    
    ProxyRequests Off
    <Proxy *>
            Order deny,allow
            Deny from all
            Allow from localhost
    </Proxy>
    ProxyPass 		/ ajp://127.0.0.1:8009/ retry=0
    ProxyPassReverse 	/ ajp://127.0.0.1:8009/ retry=0
    
  • The IP address and port number in the ProxyPass match the port you defined in the Tomcat AJP 1.3 Connector (Step 1)

...

Info
iconfalse

   Additional References

Warning
titleHaving problems with these instructions?

Please send us feedback at uportal-user@lists.ja-sig.org