Apache httpd two out-of-the-box options for proxying to any number of backend Tomcat instances:
mod_proxy_http
mod_proxy_ajp
They are configured identically to each other, except that the former uses the HTTP protocol for communication and the latter uses the AJP protocol and URLs that start with ajp://
instead of http://
for the backend server. Both can be configured for load-balancing, failover, etc. in the same way. You can proxy to completely separate Tomcat instances (i.e. no load-balancing: just separate backends) by providing separate proxy configuration for separate URL spaces (e.g. /app1
-> Tomcat1 and /app2
-> Tomcat2) or you can configure the two (or more) backend instances for load-balancing, etc.
Specifically, look at the documentation for the following httpd configuration directives:
<Proxy>
BalanceMember
ProxyPass
ProxyPassReverse
You can find documentation for all of these here:
- http://httpd.apache.org/docs/2.2/mod/mod_proxy.html (General)
- http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html (HTTP)
- http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html (AJP)
- http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html (load-balancer)
If you want to use the AJP protocol and you have more complex configuration needs, you can also use mod_jk
(not mod_jk2
, which is an old, dead, abandoned, completely irrelevant project, now). You can find out more about mod_jk
on the Tomcat site here: http://tomcat.apache.org/connectors-doc/
mod_jk
has a radically different configuration procedure and a lot more AJP-specific options than mod_proxy_ajp
.
The (short) documentation you mentioned in your original post (from the old mod_jk2
docs) points to Apache httpd's mod_proxy_ajp
and mod_proxy_balancer
modules (though it points to the unstable httpd 2.1, which was the bleeding-edge at the time that documentation was written). You were on the right track: you just needed to keep reading. You can definitely proxy to as many backend instances of Tomcat as you want with any of the modules described here.