I'm not so sure about why you would like to have the same Confluence instance published under multiple different domains, but it is easy to do. There's even a plugin available in Atlassian Marketplace with the similar purpose. Here I'll show you how you can do this without buying the plugin.
Objective
Let's first be perfectly clear about what can be done, and what we want to accomplish here. In this article I'll show how the same Confluence instance can be published under multiple domains, but with the same context path. This way, for example, you'll be able to publish the same Confluence instance under the following domains:
- mydomain.com
- myotherdomain.com
- subdomain.thirddomain.com
- secondsubdomain.mydomain.com
- ...
Or if you want to use context path:
- mydomain.com/contextpath
- myotherdomain.com/contextpath
- subdomain.thirddomain.com/contextpath
- ...
Note that all context paths are the same. This procedure won't allow us to combine different context paths, or to sometimes use the context path and sometimes not. If you decide to use context path - all the domains will have to include it; if you decide not to use context path - all domains will have to be without context path.
Approach
We'll accomplish our objective in the same way we've accomplished Atlassian Suite - SSL with Apache: by using multiple connectors and corresponding Apache virtual hosts. Just to remind you, in Atlassian Suite - SSL with Apache we've started from http://confluenceserver:8090, and we've created another domain (i.e. https://confluence.mydomain.com). What I'm trying to say is that there we've already did the trick: we already have two domains (confluenceserver and confluence.mydomain.com). Here we'll simply add another, and another, as many as we want.
Let's assume that we want to publish existing Confluence instance, configured as in Atlassian Suite - SSL with Apache, under another domain - thenewdomain.com. We'll start by creating the third Connector
element in server.xml
file as follows:
...
<Service name="Tomcat-Standalone">
<Connector port="8090"
connectionTimeout="20000"
maxThreads="200"
minSpareThreads="10"
enableLookups="false"
acceptCount="10"
debug="0"
URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol" />
<Connector port="8091"
connectionTimeout="20000"
maxThreads="200"
minSpareThreads="10"
enableLookups="false"
acceptCount="10"
debug="0"
URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="https"
proxyName="itenlight.com"
proxyPort="443"
secure="true"/>
<Connector port="8092"
connectionTimeout="20000"
maxThreads="200"
minSpareThreads="10"
enableLookups="false"
acceptCount="10"
debug="0"
URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="https"
proxyName="thenewdomain.com"
proxyPort="443"
secure="true"/>
...
Note that for the third connector I've changed port
value again, and proxyName
value to correspond to the new domain.
The next thing to do is to create another Apache virtual host as follows:
<VirtualHost thenewdomain.com:443>
ServerName thenewdomain.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLEngine On
SSLCertificateFile /etc/ssl/certs/thenewdomain_com_with_chain.crt
SSLCertificateKeyFile /etc/ssl/private/thenewdomain_com.key
ProxyPass / http://confluenceserver:8092/
ProxyPassReverse / http://confluenceserver:8092/
</VirtualHost>
Note that this time we are using different SSL certificate (since it is a different domain). But you should also know that SSL is not mandatory here, and that you can also publish Confluence at http://thenewdomain.com. If this is what you want to do, then few changes are needed:
-
The following attributes of the corresponding
Connector
element should be changed:-
scheme="http"
(instead ofhttps
); -
proxyPort="80"
(instead of443
); -
secure
attribute should be removed completely (or set tofalse
).
-
-
Virtual host should be changed:
-
<VirtualHost thenewdomain.com:80>
(instead of<VirtualHost thenewdomain.com:443>
); -
All SSL-related lines should be removed (i.e.
SSLEngine
,SSLCertificateFile
andSSLCertificateKeyFile
).
-
Finally restart Confluence and Apache, and you'll have Confluence accessible by using either of the domains set, with or without SSL depending on your setup.
Of course, to create more domains you'll simply repeat everything: new Connector
element, and new VirtualHost
.
Server Base URL
Of course we can't set different "Server Base URL" for different domains - there's only one, instance-level setting. But in my experience we don't have to. Confluence does not complain if you access it through different domain name then one set in "Server Base URL" (as JIRA does). And in my experience it will not cause any problems.
Add new comment
Anonymous comments require solving captcha, and waiting for administrator's approval.