Atlassian applications allow the use of reverse-proxies within our products, however Atlassian Support does not provide assistance for configuring them. Consequently, Atlassian can not guarantee providing any support for them.

If assistance with configuration is required, please raise a question on Atlassian Answers.

Purpose

This page describes a possible way to use NGINX to proxy requests for Confluence running in a standard Tomcat container. You can find additional documentation that explains how to use Apache mod_proxy for the very same purpose.  For Confluence 6.0 or later you’ll need a version of NGINX that supports WebSockets (1.3 or later).

Solution

Configuring Tomcat

In this example, we’ll set up Confluence to be accessed at the address http://www.example.com/confluence (on standard HTTP port 80), while Confluence itself listens on port 8090 with context path /confluence.

For Confluence 6.0 or later we also need to include Synchrony, the service that powers collaborative editing, which listens on port 8091 with the context path /synchrony.

Set context path

Set your Confluence application path (the part after hostname and port) in Tomcat.  Edit <CONFLUENCE-INSTALL>/conf/server.xml, locate the “Context” definition:

and change it to:

Restart Confluence, and check you can access it at http://example:8090/confluence

Set the URL for redirection

Next, set the URL for redirection. In the same <CONFLUENCE-INSTALL>/conf/server.xml file, locate this code segment:

And append the last line:

Configure NGINX

You will need to specify a listening server in NGINX, as in the example below. Add the following to your NGINX configuration:

For Confluence 6.0 and later:

For Confluence 5.10 and earlier

If the NGINX proxy is not listening to the same IP that the hostname resolves, please use the IP address that the proxy is listening to instead of the application hostname.

Set base URL

For normal operation of Confluence you will also need to set the base URL accordingly. In this example the base URL would be set to http://www.example.com/confluence.

Notes

  • For the settings above to take effect you need to restart both Confluence (including Synchrony) and NGINX.
  • (warning) If you encounter problems with input validation, it might be caused by the gzip compression enabled in reverse proxying. Such an issue is described in the Create Space button inactive in Add Space dialog article.