I have apache httpd that I want to proxy to two different tomcat servers.
I see this:
http://tomcat.apache.org/connectors-doc-archive/jk2/proxy.html
But that is only for one tomcat server. What if I had one server running on 8081 in addition to a tomcat running at 8080?
Apache httpd two out-of-the-box options for proxying to any number of backend Tomcat instances:
mod_proxy_httpmod_proxy_ajpThey 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 ofhttp://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:
You can find documentation for all of these here:
If you want to use the AJP protocol and you have more complex configuration needs, you can also use
mod_jk(notmod_jk2, which is an old, dead, abandoned, completely irrelevant project, now). You can find out more aboutmod_jkon the Tomcat site here: http://tomcat.apache.org/connectors-doc/mod_jkhas a radically different configuration procedure and a lot more AJP-specific options thanmod_proxy_ajp.The (short) documentation you mentioned in your original post (from the old
mod_jk2docs) points to Apache httpd’smod_proxy_ajpandmod_proxy_balancermodules (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.