The Apache mod_jk plugin is a tried and true module used in for many years. While there are newer AJP plugins, mod_jk is still quite functional and popular.
Apache should already have been installed and tested. Installation is beyond this document, but it should be easy to find instructions if needed. Application servers should be configured and tested as well. This is crucial to avoid wasting time as the many configuration changes are ripe for human error.
Connectivity needs to be verified. In many enterprise networks, security is is critical. Many network administrators and server administrators implement firewalls of varying limits. With differing ownership, having all the firewalls modified to allow traffic can be daunting at certain institutions. Below is table of firewall rules for a typical installation.
Allowing all traffic from Apache to the Tomcat servers on the network firewall is usually secure enough.
Once the firewall updates are completed, make sure to verify that requests to port 8009 on the Tomcat servers from Apache are working. At this point Tomcats
The prerequisites are the hard part.
Server.xml Connector Addition
Tomcats will need to have a new connector configured in server.xml. The new
Thread counts and connection timeout should be adjusted to your needs.
Server.xml jvmRoute Addition
To enable sticky sessions, the jvmRoute attribute needs to be set on the Engine stanza.
The value for jvmRoute needs to match the identifier for the Tomcat server defined in workers.properties in Apache. (See below.)
Installing Mod_JK varies between OSes. Debian/Ubuntu servers have it easy. Running `apt-get install libapache2-mod-jk` will perform the installation. Some other Linux distributions may have have mod_jk in their repos, so search for the package. The fallback is onerous. For OSes without a mod_jk package, you will have to download from http://tomcat.apache.org/download-connectors.cgi and follow instructions in the download.
Configuring Apache httpd.conf
The plugin needs to be loaded and configured. This can be done directly in httpd.conf or included from another file. First check if the jk_module has already been loaded in another file during installation. Simply search the Apache config files. If not, you will need to load the module manually by adding `LoadModule jk_module "<path_to_lib>/mod_jk.so"`.
Next, configure mod_jk, specifying the worker configuration file, logging, and URLs to forward.
Configuration with VirtualHosts
If your installation uses virtual hosts, you may need to add JkMountCopy On into the Virtual Host entry.
Additional JkMount entries can be included for load balancing requests to portlet APIs such as `/ResourceServingWebapp/*` to loadbalancer.
Optionally, the JK Manager can be configured for monitoring. This can be limited to privileged IPs. A few example IPs are including in the snippet below.
This snippet goes between the JkMount entries and the closing </IfModule>.
Visit http://<apache_server>/jkmanager/ to see the manager page.
The `workers.properties` file is where the Tomcat servers are specified, along with the load balancer settings and the JK Manager JkMount. In the following snippet Two Tomcat servers are configured with one receiving twice the traffic.
Restart Apache and test that the configuration is working. Open a browser and visit the JK Manager. If you have issues review the changes to httpd.conf files and the worker.properties file. Once you can reach the JK Manager, test that traffic is redirecting to the portal by pointing a browser at http://<apache_server>/uPortal/ .