The situation I want to deal with is this:
Public Web Root
|-portal1 (server A)
\-portal2 (server B)
In apache 2.2 they (the writers of the Apache docs) seem to prefer the use of mod_proxy_ajp, which is an AJP/1.3 driver for mod_proxy. At the apache end we just install mod_proxy_ajp and add a line such as the following to the proxy_ajp.conf file:
ProxyPass /portals/portal1 ajp://nigel-dev:8009/portals/portal1
Note that the paths on the proxy host and the application server are the same. This is important, as at the application end it will only know its path name from its context, and unless you want to do some url rewriting, and possible use something called ProxyHTMLURLMap. It, like most potentially useful software, isn’t available in Red Hat, so we can’t investigate this option.
So, the purpose of this post is to explain how to get the application server’s paths to match the proxies. Do the following:
- Create the path structure with in the $CATALINA_HOME/webapps directory, ie $CATALINA_HOME/webapps/portals
- Install the WAR or webapp install into its place in the hierarchy
- Create a context xml file for each application. These go in $CATALINA_HOME/conf/Catalina/localhost, and are named the same as the webapps path, with # in place of /. ie $CATALINA_HOME/conf/Catalina/localhost/portals#portal1.xml and $CATALINA_HOME/conf/Catalina/localhost/portals#portal2.xml.
- Inside these files put the following: