Confluence 6 using the basic configuration of Apache and Mod_proxy

Source: Internet
Author: User

In these examples, we use the following information:

http://www.example.com/confluence -The URL you plan to use

http://example:8090/ -Confluence the host name and port currently installed

http://example:8091/ -synchrony currently installed hostname and port, this service is used to provide the default co-editing service

/confluence -This is about the context you confluence plan to use (after hostname and port)

/synchrony -The context path used by Synchrony, which provides a collaborative editing service

You need to replace the above URL with your own URL.

1 Setting the context path

If you do not need to use context to access confluence, for example you want to use www.example.com to access this, you can skip this part of the content.

Set the path to the confluence context in your Tomcat (after the host name and port). In this example, the context path is configured to/confluence。

Edit the <installation-directory>conf/server.xml,找到 definition of "Context":

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

Then modify to:

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

In this example, we have used the /confluence path for the context. Note that you cannot use the /resources  path for your context, because this context path is used to define resources in confluence, and if you use this configuration, it will cause problems in confluence.

Restart Confluence, and then you can try to access it using http://example:8090/confluence and make sure that you are able to access it correctly.

2 setting URL redirection

Next, set up URL redirection. In the <installation-directory>conf/server.xml file, use the sample connector as your starting point.

Comment out the default connector (for access that does not use a proxy).

shows how to configure :

Uncomment the connector in the http-proxying confluence via Apache or Nginx over HTTP header listing the contents.

shows how to configure :

At the bottom of the content shown above, insert your proxyname and proxyport :

<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"   scheme="http"proxyName="www.example.com"proxyPort="80"/>

If you plan to enable HTTPS, use https-proxying confluence via Apache or Nginx over HTTPS. The following connector.

3 Configuring Mod_proxy

Use one of the following examples to edit the http.conf configuration of your file for the application Server proxy.

You need to enable some of the following modules for your Apache if these modules are not yet enabled in your Apache:

    • Mod_proxy
    • Mod_proxy_http
    • Proxy_wstunnel
    • Mod_rewrite

(Proxy_wstunnel and mod_rewrite are new modules required for Confluence 6.0)

http.confThe format of the file and the location path of the module may vary depending on the operating system you are using. You recommend that Windows users use absolute paths when configured here.

Example 1: Configuring the context Path

In this example, if you have set the context path in the first step above, your confluence server can also be accessed through the configured context path, such as this http://www.example.com/confluence.

In this example, the user will be connected to the synchrony, which is the service used for collaborative editing and is directly connected through WebSockets.

The order of configuration in the configuration file is very important.

Apache HTTP Server 2.4
# Put this after the other LoadModule directivesLoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.soLoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.soLoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.soLoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so# Put thisin the main section of your configuration (or virtual host, ifusing Apache virtual hosts)ProxyRequests OffProxyPreserveHost On<Proxy *>    Require all granted</Proxy>ProxyPass /synchrony http://<domain>:8091/synchrony<Location /synchrony>    Require all granted    RewriteEngine on    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]    RewriteRule .* ws://<domain>:8091%{REQUEST_URI} [P]</Location> ProxyPass /confluence http://<domain>:8090/confluenceProxyPassReverse /confluence http://<domain>:8090/confluence<Location /confluence>    Require all granted</Location>

Note: If you are using HTTP Server 2.2, but your confluence uses 6.0 and its subsequent versions, this configuration is not successful. If you plan to use SSL, you need to use 2.4.10 or later.

Example 2: A configuration that does not use context

In this example, if you have skipped the first step of the configuration and did not use the context path for access, for example, the URL of the access is http://www.example.com/.

In this example, the user will be connected to the synchrony, which is the service used for collaborative editing and is directly connected through WebSockets.

The order of configuration in the configuration file is very important.

Apache HTTP Server 2.4
# Put this after the other LoadModule directivesLoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.soLoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.soLoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.soLoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so# Put thisin the main section of your configuration (or virtual host, ifusing Apache virtual hosts)   ProxyRequests Off  ProxyPreserveHost On      RewriteEngine On  RewriteCond %{REQUEST_URI} !^/synchrony  RewriteRule ^/(.*) http://<domain>:8090/$1 [P]  <Proxy *>      Require all granted  </Proxy>  ProxyPass /synchrony http://<domain>:8091/synchrony  <Location /synchrony>      Require all granted      RewriteEngine on      RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]      RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]      RewriteRule .* ws://<domain>:8091%{REQUEST_URI} [P]  </Location>  ProxyPass / http://<domain>:8090  ProxyPassReverse / http://<domain>:8090     <Location />      Require all granted  </Location>

Note: If you are using HTTP Server 2.2, but your confluence uses 6.0 and its subsequent versions, this configuration is not successful. If you plan to use SSL, you need to use 2.4.10 or later.

4 Restarting Apache

In order for the new configuration to take effect, you need to run the following command to have Apache reboot and load the new configuration file:

sudo apachectl graceful
5 Disabling HTTP compression

If compression is enabled in proxy and Tomcat, this will cause problems when consolidating other Atlassian applications, such as JIRA. Please disable HTTP compression and refer to the contents of the compressing an HTTP Response within confluence page.

6 Modifying the Confluence base URL

The last step is to configure the address of the Base URL to point to the address of the proxy you are not using, such as http://www.example.com/confluence.

Https://www.cwiki.us/display/CONF6ZH/Using+Apache+with+mod_proxy

Confluence 6 using the basic configuration of Apache and Mod_proxy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.