Confluence 3.2 のサポートは終了しています。
ドキュメントの最新バージョンを確認してください。
This page describes how to integrate Confluence into an Apache website, using mod_proxy.
このページの内容
The content on this page relates to platforms which are not supported for Confluence. Consequently, Atlassian can not guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.
There are some common situations where you might do this:
- You have an existing Apache-based website, and want to add Confluence to the mix (eg. http://www.example.com/confluence).
- You have two or more Java applications, each running in their own application server on different ports, eg. http://localhost:8080/confluence and http://localhost:8081/jira. By setting up Apache with mod_proxy, you can have both available on the regular HTTP port (80), eg. at http://www.example.com/confluence and http://www.example.com/jira. If you are running JIRA and Confluence, we recommend this setup. It allows each app to be restarted, managed and debugged separately.
This page describes how to configure mod_proxy. We describe two options:
- If you want a URL like http://www.example.com/confluence/, go to the simple configuration.
- If you want a URL like http://confluence.example.com/, go to the complex configuration.
Simple configuration
コンテキストパスを設定する
First, set your Confluence application path (the part after hostname and port) correctly. Say you want Confluence available at http://www.example.com/confluence/, and you currently have it running at http://localhost:8080/. The first step is to get Confluence available at http://localhost:8080/confluence/.
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">
Then restart Confluence, and ensure you can access it at http://localhost:8080/confluence/
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://localhost:8080/confluence ProxyPassReverse /confluence http://localhost:8080/confluence <Location /confluence> Order allow,deny Allow from all </Location>
リダイレクション用 URL の設定
You will need to modify the server.xml
file in your tomcat's conf directory and set the URL for redirection.
Locate this code segment
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />
And append the following segment:
<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" proxyName="www.example.com" proxyPort="80"/>
Replace www.example.com with the URL you wish to be redirected to.
複雑な設定
A complex configuration involves using the mod_proxy_html filter to modify the proxied content en-route. This is required if the Confluence path differs between Apache and the application server. For example:
外部からアクセス可能な(Apache) URL |
http://confluence.example.com/ |
---|---|
アプリケーション サーバーの URL |
http://app-server.internal.example.com:8080/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:8080/confluence ProxyPassReverse / http://app-server.internal.example.com:8080/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.
- Create a new SSL host by creating a virtual host on 443
- The standard http connection on apache could be used to redirect to https if you want or it could just be firewalled.
- Within the VirtualHost definition:
- define the SSL options (SSLEngin and SSLCertificateFile)
- define the ProxyPass and ProxyPassReverse directives to pass through to Tomcat.
Because of how the ProxyPass and ProxyPassReverse directives work, you should not need to modify the tomcat installation at all.
Most of the relevant Apache Config:
Listen 443 NameVirtualHost *:443 <VirtualHost *:443> SSLEngine On SSLCertificateFile /etc/apache2/ssl/apache.pem ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>
詳細情報
- mod_proxy_html サイトに複雑な設定でのこのモジュールの使用に関するドキュメントと例があります。
- Apache Week のチュートリアルでは2つのアプリケーションと ProxyHTMLURLMap に関連する複雑な状況を扱っています。
- 「Apache で仮想ホストと mod_proxy を使用する 」では、仮想ホスト サブドメイン上の個別のアプリケーション サーバーで JIRA と Confluence を実行するような特殊な場合の設定方法を説明しています。
代替手段
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 を使用して、リクエストをアプリケーション サーバーに送信します。