Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Apache Proxy for Jira and Confluence

Ghaith Haddad August 29, 2019

Hello everyone,

 

So i have apache proxy SSL over jira and everything is working fine, i added confluence to the same server and now im trying to do the same thing, to have it behind apache SSL. This is my apache conf file that im using:

 


<VirtualHost *:443>

ServerAdmin webmaster@localhost
DocumentRoot /opt/atlassian/jira
ServerName my-servername.com

ProxyPreserveHost on
ProxyPass / http://mydomain:8080/
ProxyPassReverse / http://mydomain:8080/

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/jira.crt
SSLCertificateKeyFile /etc/apache2/ssl/jira.key

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

 

Now what should i add/change in this file to have confluence also behind it. FYI JIRA is at port 8080 and confluence is at port 8090. confluence home folder is /opt/atlassian/confluence.

 

Any help or guidance is greatly appreciated, thanks in advance!

 

Cheers

2 answers

1 accepted

0 votes
Answer accepted
robert Mugabuhamye
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2019

hello Ghaith. 
this is an example of one of our configuration it might help.

httpd.conf

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so

LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so

LoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

...

Include conf/jira-virtualhost.conf

Include conf/confluence-virtualhost.conf


jira-virtualhost.conf

<VirtualHost *:443>

    ServerName jira.<DOMAIN>.com

    

    ProxyRequests Off

    ProxyVia Off

    

    <Proxy *>

         Require all granted

    </Proxy>

 

    ProxyPass        / http://localhost:8080/

    ProxyPassReverse / http://localhost:8080/

    

#    SSLEngine On

#    SSLCertificateFile      /atlassian/ssl-domain/cert.pem

#    SSLCertificateKeyFile   /atlassian/ssl-domain/certprivkey.pem

#    SSLCertificateChainFile /atlassian/ssl-domain/chain.pem

     SSLEngine On

    SSLCertificateFile      /atlassian/ssl-domain/SSLCertificateFile.crt

    SSLCertificateKeyFile   /atlassian/ssl-domain/SSLCertificateKeyFile.key

    SSLCertificateChainFile /atlassian/ssl-domain/SSLCertificateChainFile.crt

</VirtualHost>

 

<VirtualHost *:80>

    ServerName         jira.<DOMAIN>.com

    Redirect Permanent / https://jira.<DOMAIN>.com

</VirtualHost>

 


 confluence-virtualhost.conf

<VirtualHost *:443>

    ServerName confluence.<DOMAIN>.com

 

    ProxyRequests Off

    ProxyPreserveHost On

    

    <Proxy *>

        Require all granted

    </Proxy>

    

    ProxyPass /synchrony http://localhost:8091/synchrony

    <Location /synchrony>

        Require all granted

        RewriteEngine on

        RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]

        RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]

        RewriteRule .* ws://localhost:8091%{REQUEST_URI} [P]

    </Location>

    

    ProxyPass        / http://localhost:8090/

    ProxyPassReverse / http://localhost:8090/

    

    SSLEngine On

    SSLCertificateFile      /atlassian/ssl-domain/SSLCertificateFile.crt

    SSLCertificateKeyFile   /atlassian/ssl-domain/SSLCertificateKeyFile.key

    SSLCertificateChainFile /atlassian/ssl-domain/SSLCertificateChainFile.crt

 

    <Location />

        Require all granted

    </Location>

 

    <Location /confluence>

        Require all granted

    </Location>

   

 

</VirtualHost>

 

<VirtualHost *:80>

    ServerName confluence.<DOMAIN>.com

    Redirect Permanent /            https://confluence.<DOMAIN>.com/

    Redirect Permanent /synchrony   https://confluence.<DOMAIN>.com/synchrony

</VirtualHost>

Ghaith Haddad August 29, 2019

Thank you @robert Mugabuhamye i will give that a try.

 

Cheers!

Ghaith Haddad August 29, 2019

quick question just to make sure. i should also change the base URL for both applications right?

robert Mugabuhamye
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2019

sorry forgot to share that>

this is the examples of the server.xml

Jira:

 

    <Service name="Catalina">

 

        <Connector port="8080"

 

                   maxThreads="150"

                   minSpareThreads="25"

                   connectionTimeout="20000"

 

                   enableLookups="false"

                   maxHttpHeaderSize="8192"

                   protocol="HTTP/1.1"

                   useBodyEncodingForURI="true"

                   redirectPort="8443"

                   acceptCount="100"

                   disableUploadTimeout="true"

                                 proxyName="jira.<DOMAIN>.com"

                              proxyPort="443"

                              secure="true"

                      scheme="https"

                   bindOnInit="false"/>

 

 ...

        <Engine name="Catalina" defaultHost="localhost">

            <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

 

                <Context path="/" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">

 

 

Confluence

 

<Server port="8000" shutdown="SHUTDOWN" debug="0">

    <Service name="Tomcat-Standalone">

        <Connector port="8090"

                         connectionTimeout="20000"

                         redirectPort="8443"

                maxThreads="48"

                         minSpareThreads="10"

                enableLookups="false"

                         acceptCount="10"

                         debug="0"

                         URIEncoding="UTF-8"

                protocol="org.apache.coyote.http11.Http11NioProtocol"

                            proxyName="confluence.<DOMAIN>.com"

                            proxyPort="443"

                            secure="true"

                    scheme="https"/>

...

 

        <Engine name="Standalone" defaultHost="localhost" debug="0">

 

            <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4">

                <Context path="/" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">

                    <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->

...
robert Mugabuhamye
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2019

if you mean the base URL in Jira, yes.
the base URL should be the one users use to access your app. if it is now the https URL, then that should be your base URLs. all your statics will be referenced using that URL 

Ghaith Haddad August 29, 2019

Thank you bro you're awesome!

robert Mugabuhamye
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 29, 2019

@Ghaith Haddad my pleasure ;)

Ghaith Haddad August 29, 2019

Hello @Gonchik Tsymzhitov 

Thank you for the reply but i've been to these links before but they only show how to setup apache proxy for one service not 2 which is what im trying to do. Or am i not missing something there?

Gonchik Tsymzhitov
Community Champion
August 29, 2019

Well, you need to set first the context path for one of service. 

https://confluence.atlassian.com/confkb/how-to-change-the-confluence-context-path-707985922.html

 

Then set in the proxy rule like 

ProxyPreserveHost on
ProxyPass /wiki http://mydomain:8090/
ProxyPassReverse /wiki http://mydomain:8090/

Ghaith Haddad August 29, 2019

ok after i set the context path for confluence should i add

 

ProxyPreserveHost on
ProxyPass /wiki http://mydomain:8090/
ProxyPassReverse /wiki http://mydomain:8090/

 

 to the same apache proxy file that i have? so in a sense i would have 2 of these one for jira and one for confluence?

Suggest an answer

Log in or Sign up to answer