There are some common situations where you might use the configuration:
- You have an existing Apache-based website, and want to add Confluence to the mix (for example, ).
- You have two or more Java applications, each running in their own application server on different ports, for example, and . By setting up Apache with mod_proxy, you can have both available on the regular HTTP port (80) – for example, at and . This allows each application to be restarted, managed and debugged separately.
Note: This page documents a configuration of Apache, rather than of Confluence itself. Atlassian will support Confluence with this configuration, but we cannot guarantee to help you debug problems with Apache. Please be aware that this material is provided for your information only, and that you use it at your own risk.
In these examples, we use the following:
http://www.example.com/confluence - your intended URL
http://example:8090 - the hostname and port Confluence is currently installed to
/confluence - the intended context path (the part after hostname and port)
Please substitute the examples below with your intended URL's in your own server. Copy/pasting these suggestions will not work on your server.
Set the context path
Set your Confluence application path (the part after hostname and port). To do this in Tomcat (bundled with Confluence), edit
conf/server.xml, locate the "Context" definition:
and change it to:
Then restart Confluence, and ensure you can access it at
Set the URL for redirection
Set the URL for redirection. In the same
conf/server.xml file, locate this code segment:
And append the last line:
If this isn't working for you and you're using SSL, try adding a scheme attribute to your Connector tag: scheme="https".
Now we have two options:
- If you want a URL like , follow the simple configuration.
- If you want a URL like complex configuration. , go to the
Now enable mod_proxy in Apache, and proxy requests to the application server by adding the example below to your Apache httpd.conf (note: the files may be different on your system; the JIRA docs describe the process for Ubuntu/Debian layout):
It is recommended that you specify the absolute path to the
Complex configuration involves using the mod_proxy_html filter to modify the proxied content en-route. This is required if the Confluence path differs between Apache and the application server. For example:
Externally accessible (Apache) URL
Application server URL
Notice that the application path in the URL is different in each. On Apache, the path is /, and on the application server the path is /confluence.
For this configuration, you need to install the mod_proxy_html module, which is not included in the standard Apache distribution.
Alternative solutions are discussed below.
The ProxyHTMLURLMap configuration can become more complex if you have multiple applications running under this configuration. The mapping should also be placed in a Location block if the web server URL is a subdirectory and not on a virtual host. The Apache Week tutorial has more information how to do this.
Final Configuration Steps
Restart your Apache server
This is needed to pick up on the new configuration. This can be done by running the following on your command line/terminal/shell:
Disable HTTP Compression
Having compression run on both the proxy and Tomcat can cause problems integrating with other Atlassian applications, such as JIRA. Please disable HTTP compression as per our Compressing an HTTP Response within Confluence docs.
Set the Confluence Base URL
If you're running Apache in front of Tomcat, it's a good idea to terminate your SSL configuration at Apache, then forward the requests to Tomcat over HTTP. You can set up Apache to terminate the SSL connection and use the ProxyPass and ProxyPassReverse directives to pass the connection through to Tomcat (or the appropriate application server) which is running Confluence.
- Create a new SSL host by creating a virtual host on 443
- The standard http connection on apache could be used to redirect to https if you want or it could just be firewalled.
- Within the VirtualHost definition:
- define the SSL options (SSLEngin and SSLCertificateFile)
- define the ProxyPass and ProxyPassReverse directives to pass through to Tomcat.
Most of the relevant Apache Config:
Apart from the Apache configuration there are a couple of things you will need to do before you get your server working:
- You will have to change your base URL to point to https addresses. See the documentation on configuring the server base URL.
- We need to set up the connector to use https. In your installation directory, edit the file server.xml and add this attributes to your connector:
- The mod_proxy_html site has documentation and examples on the use of this module in the complex configuration.
- Apache Week has a tutorial that deals with a complex situation involving two applications and ProxyHTMLURLMap.
- Using Apache with virtual hosts and mod_proxy shows how to configure the special case where you want JIRA and Confluence running on separate application servers on virtual host subdomains.
If Tomcat is your application server, you have two options:
- use mod_jk to send the requests to Tomcat
- use Tomcat's virtual hosts to make your Confluence application directory the same on the app server and the web server, removing the need for the URL mapping.
If your application server has an AJP connector, you can:
- use mod_jk to send the requests to your application server.