Confluence behind Apache: How to address Confluence by subdomain and not by Tomcat context path?

I have a server machine with a Confluence and an Apache server installed on it.
The Apache server is publicly adressable by mycompany.com:80.
The Confluence application is in Tomcat context /confluence.
In the apache server I have a <VirtualHost> with ServerName confluence.mycompany.com forwarding requests to JkMount /* worker1.

My current setup results in URLs like http://confluence.mycompany.com/confluence/display/...

I would like to have URLs in the public like http://confluence.mycompany.com/display/...

The point is, to adress the Confluence system by subdomain name, which I would like to show in the public, instead of by context path segment, which I prefer to use internally only.

What is the recommended setup to get rid of the path prefix /confluence? Do I need a <Context path="/" docBase="../confluence" in Tomcat? Is it possible/problematic to have Confluence at the root path in Tomcat? Or can I do the mapping without the /confluence path in Apache?

2 answers

Hi Markus

I'm not a major expert, but I have a similar setup (confluence behind apache proxy), maybe my setup will help answer your question. NOTE: I use mod_proxy, not mod_jk. FYI. My site is not publically accessible.

Apache setup:

&lt;VirtualHost *:80&gt;
  ServerName     confluence.mydomain.com
  ServerAlias    confluence

  ErrorLog       /var/log/apache2/confluence-error.log
  CustomLog      /var/log/apache2/confluence-access.log combined

  ProxyRequests     Off
  ProxyPreserveHost On

  &lt;Proxy *&gt;
    Order deny,allow
    Allow from all
  &lt;/Proxy&gt;

  # Make sure the requests are redirected
  ProxyPass        /  http://localhost:8280/
  ProxyPassReverse /  http://localhost:8280/

  &lt;Location /&gt;
    Order allow,deny
    Allow from all
  &lt;/Location&gt;

&lt;/VirtualHost&gt;

Tomcat Server.xml

(changes to connector, to add proxyName and proxyPort).

...
...
        &lt;Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8280" minProcessors="5"
                   maxProcessors="75"                   enableLookups="false" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="20000"                   useURIValidationHack="false" URIEncoding="UTF-8"                   proxyName="confluence.mydomain.com" proxyPort="80"/&gt;

...
                &lt;Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true"&gt;
...
...

Remeber to change "server base url" in confluence admin / general config to: http://confluence.mydomain.com

Hope this is of some use.

Gavin.

I would recommend using the same contextpath on your usual domain and on your subdomain.

You can use different on apache, but not on tomcat, so you can use some rewrite tools to handle this, but, I think, it will not be nice and easy. And Confluence can not handle different contextpaths. And it can not handle different baseurls. This might be an interesting problem to solve in your setup.

But to come back to your original question, keep one contextpath for all, and if you don't need /confluence I would recommend using / .If that is possible on your setup...

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

1,005 views 23 13
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you