Apache and Tomcat communication changes
This document (3744935) is provided subject to the disclaimer at the end of this document.
Environment
Situation
Communication between Tomcat and Apache is not available through the mod_jk.so module using JkMount configuration directives.
Resolution
- Open YaST.
- Click "Network Services".
- Click "HTTPD Server".
- Click onto the modules tab.
- Locate "proxy" in the list, and ensure it is enabled.
- Check for "proxy_ajp" in the list. If not there, click"Add" and then choose the "proxy_ajp" module. Ensure it is enabled.
- 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/* ajp13configuration 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 ajp13Would 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
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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com