Using Apache with mod_jk
The Apache web server is often used in front of an application server to improve performance in high-load environments. Mod_jk allows request forwarding to an application via a protocol called AJP. Configuration of this involves enabling mod_jk in Apache, configuring a AJP connector in your application server, and directing Apache to forward certain paths to the application server via mod_jk.
Mod_jk is sometimes preferred to mod_proxy because AJP is a binary protocol, and because some site administrators are more familiar with it than with mod_proxy..
The scope of this documentation is limited to configuring the AJP connector in Tomcat 5.x. Other application servers may support AJP connectors; please consult your application server documentation for instructions on how to configure it.
The configuration below assumes your Confluence instance is accessible on the same path on the application server and the web server. For example:
Externally accessible (web server) URL
Application server URL (HTTP)
The AJP connection of the application server is set to: app-server.internal.example.com:8009.
Configuring mod_jk in Apache
The standard distribution of Apache does not include mod_jk. You need to download it from the JK homepage and put the mod_jk.so file in your Apache modules directory.
Next, add the following in httpd.conf directly or included from another file:
Create a new file called 'workers.properties', and put it in your Apache conf directory. (The path for workers.properties was one of the configuration settings above.)
Tomcat 5.x configuration
In Tomcat 5, the AJP connector is enabled by default on port 8009. An absolutely minimal Tomcat server.xml is below for comparison. The relevant line is the Connector with port 8009 – make sure this is uncommented in your server.xml.
Points to note:
- the Connector on port 8009 has protocol of "AJP/1.3". This is critical.
- the Context path of the Confluence application is "/confluence". This must match the path used to access Confluence on the web server.
- we recommend keeping your application Contexts outside the server.xml in Tomcat 5.x. The above example includes them for demonstration only.
Improving the performance of the mod_jk connector
The most important setting in high-load environments is the number of processor threads used by the Tomcat AJP connector. By default, this is 200, but you should increase it to match Apache's maxThreads setting (256 by default):
All the configuration parameters for the AJP connector are covered in the Tomcat documentation.
Ensuring UTF-8 compatibility
If you have problems downloading attachments with non-ASCII characters in the filename, add the following to your Apache configuration:
And specify UTF-8 as the URIEncoding in the AJP connector configuration:
These settings are discussed further on Configuring Tomcat's URI encoding.
The Tomcat JK website has complete documentation on workers.properties and Apache configuration. You can also find information there on how to use mod_jk with IIS.
Note: In IIS proxy server the maximum file upload is 30mb by default. Contact your server administrator if you need to upload a bigger file.
Was this helpful?
Thanks for your feedback!