This page describes how to set up NGINX as a reverse proxy for Confluence.
このページに記載されている構成は、次のシナリオの結果を示しています。
- NGINX との外部クライアント接続が SSL で保護されている。NGINX と Confluence Server の間の接続が保護されていない。
- Confluence Server と NGINX が同じマシン上で実行されている。
On this page
We assume that you already have a running instance of NGINX. If not, refer to the NGINX documentation for instructions on downloading and installing NGINX. SSL certificates must be installed on the server machine. You'll an NGINX version that supports WebSockets (1.3 or later).
チームが Confluence Server モバイル アプリを使用ことを計画している場合、信頼できる認証局が発行した証明書が必要となります。自己署名証明書や、信頼されない認証局またはプライベート認証局が発行した証明書でアプリを使用することはできません。
Atlassian Support can't provide assistance with configuring third-party tools like NGINX. If you have questions, check the NGINX documentation, ask the Atlassian Community, or get help from a Solution Partner.
ステップ 1: コンテキスト パスの設定
If you want to access Confluence without a context path (www.example.com), or via a sub-domain (confluence.example.com) skip this step.
Tomcat の Confluence のアプリケーション パス (ホスト名とポートに続く部分) を設定します。<installation-directory>/conf/server.xml
を編集し、"Context" 定義を見つけます。
<Context path="" docBase="../confluence" debug="0" reloadable="false">
次のように変更します。
<Context path="/confluence" docBase="../confluence" debug="0" reloadable="false">
この例では、コンテキスト パスとして /confluence
を使用しています。/resources
は Confluence によって使用されており、問題を防ぐため、コンテキスト パスとして使用することはできない点にご注意ください。
Confluence を再起動し、http://example:8090/confluence にアクセス可能かどうかを確認します。
ステップ 2: Tomcat コネクタを設定する
同じ <installation-directory>conf/server.xml
ファイルで、開始点としてサンプル コネクタを使用します。
既定のコネクタをコメント アウトします (プロキシされないアクセス用)。
「HTTPS - Apache または Nginx 経由の、Confluence へのプロキシされた HTTPS アクセス」見出しの下に記載されているコネクタのコメントを外します。
次の最終行のように、proxyName と 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="https" secure="true" proxyName="www.example.com" proxyPort="443"/>
protocol
と proxyName
に正しい値が含まれていることを確認します。
ステップ 3: NGINX の構成
次の例のように、NGINX でリッスン サーバーを指定する必要があります。NGINX 構成に以下を追加します。
サーバー名、および SSL 証明書とキーの場所を置き換えます。
この例では、ユーザーは共同編集に必要な Synchrony に直接接続します。
server { listen www.example.com:80; server_name www.example.com; listen 443 default ssl; ssl_certificate /usr/local/etc/nginx/ssl/nginx.crt; ssl_certificate_key /usr/local/etc/nginx/ssl/nginx.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20- POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256: ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA- AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA- AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE- ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE- RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM- SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3- SHA:!DSS'; ssl_prefer_server_ciphers on; location /synchrony { 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"; } 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; } }
See https://nginx.org/en/docs/http/ngx_http_proxy_module.html for more information.
注: SSL と Confluence を同じサーバー上で構成する場合、この例の ssl on;
を含めないでください。
If you're not sure what to include for ssl_ciphers
, https://mozilla.github.io/server-side-tls/ssl-config-generator/ is a useful resource.
If you experience 413 Request Entity Too Large errors, make sure that the client_max_body_size in the /confluence
location block matches Confluence's maximum attachment size. You may also need to increase the client_max_body_size in the /synchrony
location block if you experience errors when editing large pages.
ステップ 4: Confluence と NGINX を再起動する
- すべての変更内容を反映するには、 Confluence と NGINX を再起動します。
- Update Confluence's base URL to include the context path you set earlier - see Configuring the Server Base URL.