このページでは、mod_proxy を使用して Apache web サイトに Confluence を統合する方法を説明します。

 

設定を使用する場合がある状況がいくつかあります。

Note: This page documents a configuration of Apache, rather than of Confluence itself. Atlassian will support Confluence with this configuration, but we cannot guarantee to help you debug problems with Apache. Please be aware that this material is provided for your information only, and that you use it at your own risk.

We describe two options:

Simple configuration

これらの例では、以下を使用します。

http://www.example.com/confluence - 希望の URL

http://example:8090 - 現在 Confluence がインストールされているホスト名とポート

/confluence - 希望のコンテキスト パス(ホスト名とポートの後の部分)

以下の例では、ご利用のサーバーの希望の URL に置き換えてください。以下の内容のコピー/貼り付けをすると、ご利用のサーバーで動作しません。

コンテキストパスを設定する

Set your Confluence application path (the part after hostname and port). To do this in Tomcat (bundled with Confluence), edit conf/server.xml, locate the "Context" definition:

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

次のように変更します。

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

Confluence を再起動し、http://example:8090/confluence でアクセスできることを確認します。

リダイレクション用 URL の設定

Set the URL for redirection. In the same conf/server.xml file, locate this code segment:

    <Connector port="8090" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />

最後の行を追加します。

    <Connector port="8090" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"
               proxyName="www.example.com" proxyPort="80" />

If this isn't working for you, try adding a scheme attribute to your Connector tag: scheme="https".

mod_proxy の設定

Now enable mod_proxy in Apache, and proxy requests to the application server by adding the example below to your Apache httpd.conf (note: the files may be different on your system; the JIRA docs describe the process for Ubuntu/Debian layout):

# Put this after the other LoadModule directives
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so

# Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts)
ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /confluence http://www.example.com/confluence
ProxyPassReverse /confluence http://www.example.com/confluence
<Location /confluence>
    Order allow,deny
    Allow from all
</Location>

It is recommended that you specify the absolute path to the mod_proxy.so and mod_proxy_http.so files.

Apache サーバーの再起動

これは新しい設定を有効するのに必要です。コマンドライン/ターミナル/シェルで以下を実行することで完了できます。

sudo apachectl graceful

Confluence の Base URL の設定

The last stage is to set the Base URL to the address you're using within the proxy. In this example, it would be http://www.example.com/confluence

複雑な設定

複雑な設定は、mod_proxy_html フィルタを使用して、途中のプロキシされたコンテンツを変更することに関連します。Apache とアプリケーション サーバーの間で Confluence のパスが異なる場合にこれが必要になります。例:

外部からアクセス可能な(Apache) URL

http://confluence.example.com/

アプリケーション サーバーの URL

http://app-server.internal.example.com:8090/confluence/

URL のアプリケーション パスがそれぞれ異なっていることに注意してください。Apache ではパスが / ですが、アプリケーション サーバーではパスが /confluence になっています。

この設定の場合、標準の Apache ディストリビューションに含まれない mod_proxy_html モジュールをインストールする必要があります。

別のソリューションを以下で説明します。

# Put this after the other LoadModule directives
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_html_module modules/mod_proxy_html.so

<VirtualHost *>
    ServerName confluence.example.com
    
    # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts)
    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    
    ProxyPass / http://app-server.internal.example.com:8090/confluence
    ProxyPassReverse / http://app-server.internal.example.com:8090/confluence
    
    ProxyHTMLURLMap / /confluence/
    
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

複数のアプリケーションがこの設定で実行している場合、ProxyHTMLURLMap 設定が、より複雑になる可能性があります。web サーバー URL がサブディレクトリであり、仮想ホスト上にない場合、マッピングを Location ブロックにも記載する必要があります。Apache Week チュートリアルには、このための情報がより多くあります。

SSL の追加

If you're running Apache in front of Tomcat, it's a good idea to terminate your SSL configuration at Apache, then forward the requests to Tomcat over HTTP. You can set up Apache to terminate the SSL connection and use the ProxyPass and ProxyPassReverse directives to pass the connection through to Tomcat (or the appropriate application server) which is running Confluence.

  1. Create a new SSL host by creating a virtual host on 443
  2. The standard http connection on apache could be used to redirect to https if you want or it could just be firewalled.
  3. Within the VirtualHost definition:
    1. define the SSL options (SSLEngin and SSLCertificateFile)
    2. define the ProxyPass and ProxyPassReverse directives to pass through to Tomcat.

Most of the relevant Apache Config:

Listen 443

NameVirtualHost *:443
<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/apache.pem
    ProxyPass / http://localhost:8090/
    ProxyPassReverse / http://localhost:8090/
</VirtualHost>

Apart from the Apache configuration there is a couple of things you will need to do before you get your server working:

  1. You will have to change your base URL to point o https addresses. See the documentation on configuring the server base URL.
  2. We need to set up the connector to use https. In your installation directory, edit the file server.xml and add this attributes to your connector:
proxyName="proxy.example.com" proxyPort="443" scheme="https"

詳細情報

代替手段

Tomcat がアプリケーション サーバーの場合、2つの選択肢があります。

  • mod_jk を使用してリクエストを Tomcat に送信します。
  • use Tomcat's virtual hosts to make your Confluence application directory the same on the app server and the web server, removing the need for the URL mapping.

アプリケーション サーバーが AJP コネクタを持っている場合

  • mod_jk を使用して、リクエストをアプリケーション サーバーに送信します。