Confluence 5.7 has reached end of life
Check out the [latest version] of the documentation
There are some common situations where you might use the configuration:
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 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:
<Context path="" docBase="../confluence" debug="0" reloadable="true">
and change it to:
<Context path="/confluence" docBase="../confluence" debug="0" reloadable="true">
Then restart Confluence, and ensure you can access it at http://example:8090/confluence
Set the URL for redirection. In the same conf/server.xml
file, locate this code segment:
<Connector port="8090" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />
And append the last line:
<Connector port="8090" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" proxyName="www.example.com" proxyPort="80" />
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:
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):
# Put this after the other LoadModule directives LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts) ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /confluence http://app-server.internal.example.com:8090/confluence ProxyPassReverse /confluence http://app-server.internal.example.com:8090/confluence <Location /confluence> Order allow,deny Allow from all </Location>
# Put this after the other LoadModule directives LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts) ProxyRequests Off ProxyPreserveHost On <Proxy *> # Auth changes in 2.4 - see http://httpd.apache.org/docs/2.4/upgrading.html#run-time Require all granted </Proxy> ProxyPass /confluence http://app-server.internal.example.com:8090/confluence ProxyPassReverse /confluence http://app-server.internal.example.com:8090/confluence <Location /confluence> # Auth changes in 2.4 - see http://httpd.apache.org/docs/2.4/upgrading.html#run-time Require all granted </Location>
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 | http://confluence.example.com/ |
---|---|
Application server URL | http://app-server.internal.example.com:8090/confluence/ |
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.
# Put this after the other LoadModule directives LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_html_module modules/mod_proxy_html.so <VirtualHost *> ServerName confluence.example.com # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts) ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://app-server.internal.example.com:8090/confluence ProxyPassReverse / http://app-server.internal.example.com:8090/confluence ProxyHTMLURLMap / /confluence/ <Location /> Order allow,deny Allow from all </Location> </VirtualHost>
# Put this after the other LoadModule directives LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_html_module modules/mod_proxy_html.so <VirtualHost *> ServerName confluence.example.com # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts) ProxyRequests Off ProxyPreserveHost On <Proxy *> # Auth changes in 2.4 - see http://httpd.apache.org/docs/2.4/upgrading.html#run-time Require all granted </Proxy> ProxyPass / http://app-server.internal.example.com:8090/confluence ProxyPassReverse / http://app-server.internal.example.com:8090/confluence ProxyHTMLURLMap / /confluence/ <Location /> # Auth changes in 2.4 - see http://httpd.apache.org/docs/2.4/upgrading.html#run-time Require all granted </Location> </VirtualHost>
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.
This is needed to pick up on the new configuration. This can be done by running the following on your command line/terminal/shell:
sudo apachectl graceful
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.
The last stage is to set the Base URL to the address you're using within the proxy. In this example, it would be http://www.example.com/confluence
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.
Most of the relevant Apache Config:
Listen 443 NameVirtualHost *:443 <VirtualHost *:443> SSLEngine On SSLCertificateFile /etc/apache2/ssl/apache.pem ProxyPass / http://localhost:8090/ ProxyPassReverse / http://localhost:8090/ </VirtualHost>
Apart from the Apache configuration there are a couple of things you will need to do before you get your server working:
proxyName="proxy.example.com" proxyPort="443" scheme="https" secure="true"
If Tomcat is your application server, you have two options:
If your application server has an AJP connector, you can: