NGINX を使用して Confluence へのリクエストをプロキシする方法

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

アトラシアン アプリケーションの製品内でリバース プロキシを使用できますが、アトラシアン サポートはその設定についての支援は行いません。つまり、アトラシアンではリバース プロキシに関するあらゆるサポートの提供が保証されません

設定でサポートが必要な場合、アトラシアン コミュニティに質問を登録してください。

目的

This page describes a possible way to use NGINX to proxy requests for Confluence running in a standard Tomcat container. You can find additional documentation that explains how to use Apache mod_proxy for the very same purpose.  For Confluence with Collaborative Editing enabled, you'll need a version of NGINX that supports WebSockets (1.3 or later). 

ソリューション

 Tomcat の設定

この例では、http://www.example.com/confluence アドレス (標準 HTTP ポート 80) でアクセス可能な Confluence をセットアップします。Confluence はポート 8090 でリッスンし、/confluence のコンテキスト パスを使用します。

Confluence 6.0 以降の場合、共同編集を提供するサービスである Synchrony も含める必要があります。これはポート 8091 でリッスンし、/synchrony のコンテキスト パスを使用します。

コンテキスト パスの設定

Tomcat の Confluence のアプリケーション パス (ホスト名とポートの後の部分) を設定します。<CONFLUENCE-INSTALL>/conf/server.xml を編集し、"Context" の定義を見つけます。

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

次のように変更します。

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

Restart Confluence, and check you can access it at http://www.example.com:8090/confluence

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

次に、リダイレクション用の URL を設定します。同じ <CONFLUENCE-INSTALL>/conf/server.xml ファイルで、次のコード セグメントを見つけます。

<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"/>

最後の行を追加します。

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

NGINX の設定

次の例のように、NGINX でリッスン用のサーバーを指定する必要があります。NGINX 構成に以下を追加します。

For Confluence 6+ with Collaborative Editing enabled:

server {
    listen 80;
    server_name www.example.com;
    location /confluence {
        client_max_body_size 100m;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://localhost:8090/confluence;
    }
    location /synchrony {
		client_max_body_size 100m;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:8091/synchrony;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}


Confluence 5.10 以前:

server {
    listen 80;
    server_name www.example.com;
    location /confluence {
        client_max_body_size 100m;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://localhost:8090/confluence;
    }
}


対象のホスト名で解決される IP アドレスを NGINX プロキシがリッスンしていない場合、アプリケーションのホスト名ではなくプロキシがリッスンしている IP アドレスを使用します。

For Confluence 5.10 and earlier if large pages are not loading completely, you can try to disable proxy_request_buffering & proxy_buffering in the NGINX config as below (These directives are enabled by default).

proxy_request_buffering off;
proxy_buffering off;


ベース URL の設定

Confluence の標準的な運用の一環として、ベース URL を設定する必要があります。この例では、ベース URL を http://www.example.com/confluence に設定します。

注意

  • 上述の設定を反映するには、Confluence (Synchrony を含む) と NGINX の両方を再起動する必要があります。

    入力情報の検証で問題が発生した場合、リバース プロキシで有効化されている gzip 圧縮が影響している可能性があります。この問題については「スペースの追加ダイアログでスペースの作成ボタンが利用できない」をご参照ください。

  • Confluence のコンテキスト パスがない場合、proxy_pass 行で URL の末尾にスラッシュ "/" 記号が使用されていないことを確認します。これを行わない場合、次の問題が発生する可能性があります。例:

    server {
        listen 80;
        server_name www.example.com;
        location / {
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
            proxy_pass http://localhost:8090;
        }
    }
  • 413 Request Entity Too Large エラーが発生する場合、/confluence ロケーション ブロックの client_max_body_sizeConfluence maximum attachment size に一致しているかどうかを確認します。サイズの大きいページの編集でエラーが発生する場合、/synchrony ロケーション ブロックの client_max_body_size も増加させる必要がある場合があります。
説明

This page describes a possible way to use NGINX to proxy requests for Confluence running in a standard Tomcat container.

製品Confluence
最終更新日: 2024 年 2 月 5 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.