SUSE Support

Here When You Need Us

Apache and Tomcat communication changes

This document (3744935) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 10
 

Situation

Apache 2.2 and Tomcat 5.0
Communication between Tomcat and Apache is not available through the mod_jk.so module using JkMount configuration directives.

Resolution

The resolution requires enabling different modules to cause this to operate, and then configuration changes. First, to ensure the appropriate modules are enabled :
 
  1. Open YaST.
  2. Click "Network Services".
  3. Click "HTTPD Server".
  4. Click onto the modules tab.
  5. Locate "proxy" in the list, and ensure it is enabled.
  6. Check for "proxy_ajp" in the list. If not there, click"Add" and then choose the "proxy_ajp" module. Ensure it is enabled.
  7. Additionally, enable the "rewrite" module. This is not required in certain circumstances (listed in the additional notes section of this document).

At this point, restarting Apache should enable mod_proxy and mod_proxy_ajp when loading. We now need to configure the web application handling mechanism. First, determine if Apache will be serving images and HTML, but tomcat serves JSP files all from inside of the same directory. If this is not the case, configuration is easily done by changing the
JkMount /webapplication/* ajp13
configuration line to
ProxyPass /webapplication/ ajp://localhost:8009/webapplication/
And restart apache. If a single directory contains both HTML and JSP files, the ProxyPass directive will not handle the *.jsp mechanism. Instead, the rewrite module (step 7 in enabling the appropriate modules) is required, and a special RewriteRule directive is used. The syntax for the RewriteRule directive :
RewriteRule REQUEST_URI TARGET [FLAGS]
For example :
JkMount /gw/*.jsp ajp13
Would be rewritten as :
RewriteRule ^/gw(.*\.jsp)$ ajp://localhost:8009/gw/$1 [P]
This rule simply enables the proxy module using RewriteRule for anything that matches the parameter (the [P] flag). The example above will send anything hit with /gw/*.jsp and forward it to tomcat using the ajp protocol on port 8009 for the localhost.

Once the configuration is set up, restart Apache, and it should now be communicating with Tomcat.

Additional Information

In SUSE Linux Enterprise Server 10, Apache 2.0 had been phased out, and Apache 2.2 was used. This web server configuration no longer used the mod_jk.so extensions for communication with Tomcat, as that could be accomplished with newer core modules for apache, specifically the proxy and proxy_ajp modules.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3744935
  • Creation Date: 08-Nov-2006
  • Modified Date:05-Mar-2021
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.