Confluence-Installation behind Apache Webserver
Problem:
- On the server there's already an apache listening on port 80
- Confluence deployed on Tomcat 5.5 (listening on port 8080, but who wants a URL:8080).
- Internal URL: http://localhost:8080/confluence
- External URL: http://example.com/confluence
Solution
Quite a few pages, even Atlassian themselves, write a lot about using the Apache module mod_proxy. Even together with an Atlassian support person (yes, they offer full support, even if you paid only 5$) I didn't succeed.
For some strange reasons some certain ressources (certain CSS and JS) weren't delivered (404) while others were ok.
The Apache-Tomcat-Connector mod_jk took just a few steps to success though. It is using the Apache JServ Protocol (AJP), which I never heard about so far.
install mod_jk
apt-get install libapache2-mod-jk
load and configure mod_jk (/etc/apache2/mods-enabled/jk.load)
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so JkWorkersFile /etc/apache2/workers.properties JkLogFile /var/log/apache2/mod_jk.log JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories JkRequestLogFormat "%w %V %T"
configure Tomcat (conf/server.xml)
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" minSpareThreads="5" maxThreads="256" URIEncoding="UTF-8" enableLookups="false" />
configure worker (/etc/apache2/workers.properties)
worker.list=worker1 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.type=ajp13
configure Apache vhost
<VirtualHost *>
ServerName example.com
CustomLog /var/log/apache2/example.com.log
JkMount /confluence worker1
JkMount /confluence/* worker1
</VirtualHost>