JIRA と Apache の統合

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

設定に関してサポートが必要であれば、Atlassian Answers に質問をあげてください。

This page describes how to integrate Apache HTTP Server (also referred to as httpd) with JIRA, utilising mod_proxy so that Apache operates as a reverse-proxy over HTTP. If HTTPS configuration is required, please see our Integrating JIRA with Apache using SSL documentation. Configuring Apache allows for running JIRA on non-standard HTTP port (such as 8080) and users will be able to access JIRA over standard HTTP as their traffic will be routed through the proxy.

JIRA への以下のどのアクセス方式も、Apache の設定により可能です:

This documentation will cover a straightforward implementation of mod_proxy using the above three configurations. If a more complication solution is required, refer to the Apache HTTP Server Version Documentation, consult with the Apache SME within your organisation and if need be raise a question on Atlassian Answers or look at getting in touch with one of our Atlassian Experts.

一般的な Apache 設定例を展開する
  1. JIRA を、外部からアクセスできない (ルーター/ファイアウォールがアクセスをポート 8080 に転送しない) LAN 内のサーバのポート 8080 で実行します。
  2. Apache は外部から HTTP (ポート 80) アクセスが可能な別のサーバー (または JIRA と同一のサーバー) 上で実行されている。
  3. Apache is then accessed over HTTP on the appropriate URL (VirtualHost), routing the traffic to and from the JIRA server.

ステップ 1: Tomcat を設定する

  1. Jira を停止します。
  2. Edit Tomcat's server.xml to include the required JIRA context path. The below example uses path="/jira" - this means JIRA is accessible on http://jiraserver:8080/jira given the default JIRA port is used.

    This step is only required if JIRA will be accessed on a context path, for example http://atlassian.com/jira. If this is not required, this step can be skipped.

            <Engine defaultHost="localhost" name="Catalina">
                <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
                    <Context docBase="${catalina.home}/atlassian-jira" path="/jira" reloadable="false" useHttpOnly="true">
    
                        <!--
                         ====================================================================================
                         Note, you no longer configure your database driver or connection parameters here.
                         These are configured through the UI during application setup.
                         ====================================================================================
                        -->
                        <Resource auth="Container" factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60" name="UserTransaction" type="javax.transaction.UserTransaction"/>
                        <Manager pathname=""/>
                    </Context>
                </Host>

    (info) path の値がスラッシュ (/) を使用して設定されていることを確認します。たとえば、path="jira" ではなく path="/jira" と指定します。

  3. Edit Tomcat's server.xml to include a separate connector to proxy the requests. This requires the proxyName & proxyPort attributes. Replace them with the appropriate domain and port of the proxy, as in the below example:

    <Service name="Catalina">
     
    	<!-- Apache Proxy Connector -->
            <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" port="8080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true" 
                proxyName="jira.atlassian.com" proxyPort="80"/> 
    
    	<!-- Standard HTTP Connector -->
            <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" port="8081" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"/>

    (info) The proxyName parameter should be set to the FQDN that the JIRA server will be accessed on - for example jira.example.com if accessing it on http://jira.example.com or example.com if accessing it on http://www.example.com/jira. It should not include the context path.

  4. Jira を起動します。
  5. Test that JIRA is accessible on the normal connector, using a context path if applicable - for example http://jiraserver:8081/jira.
  6. Test that the new connector is working by accessing JIRA on the appropriate proxy connector, for example http://jiraserver:8080/. This should redirect to the proxy FQDN (in this example, http://jira.atlassian.com), which will fail as the proxy is not yet configured. The test is to ensure Tomcat is set up to correctly redirect to the proxy.

ステップ 2: Apache HTTP サーバを設定する

Apache のインストールおよび DNS の構成に関しては、本ドキュメントでは扱っていません。また、Apache 2.2 がインストール済みであり、DNS エントリーが JIRA ドメイン向けに設定されているものと想定しています。Apache の設定は利用する OS によって異なるため、現在のドキュメントは一部のディストリビューションの設定のみとなっています。

2.1 プロキシモジュールを有効化する

Debian/Ubuntu
Debian / Ubuntu での手順を展開して確認
  1. 以下の方法で、モジュールを有効化します:

    $ sudo a2enmod proxy_http
    Considering dependency proxy for proxy_http:
    Enabling module proxy.
    Enabling module proxy_http.
    To activate the new configuration, you need to run:
      service apache2 restart
  2. Apache を再起動します。
Windows/その他の OS
Windows/その他の OS 向け解説を詳しく見る
  1. httpd.conf ファイルを編集し、以下の行を加えます:

    LoadModule proxy_module modules/mod_proxy.so 
    LoadModule proxy_connect_module modules/mod_proxy_connect.so 
    LoadModule proxy_http_module modules/mod_proxy_http.so
  2. Apache を再起動します。

2.2 これらのモジュールを使用するように、Apacheを設定します

Debian/Ubuntu
Debian / Ubuntu での手順を展開して確認
  1. root ユーザーに切り替えます。
  2. 既存サイトをバックアップするか、新しく作成します。新しいサイトの作成に関しては、本ドキュメントでは扱っていません(デフォルトのコピーで十分なはずです)。
  3. Modify the existing site within $APACHE_INSTALL/sites-available, for example default.
  4. Add the following inside the VirtualHost, replacing jiraserver with the hostname of the JIRA server and also modifying the port if required.

    自らのドメインまたはサブドメインへアクセスする場合:
    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /       http://jiraserver:8080/
    ProxyPassReverse        /       http://jiraserver:8080/

    (info) URLの前の/(スラッシュ)を忘れると、プロキシーエラーが発生しますので必ず付け加えてください。

    The configuration above is for Apache 2.2. In Apache 2.4 you should replace Order deny, allow Allow from all to Require all granted

    コンテキストパスを利用する場合:
    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /jira       http://jiraserver:8080/jira
    ProxyPassReverse        /jira       http://jiraserver:8080/jira

    (info) 使用するパスは、Tomcat のコンテキスト パスと同一のものである必要があります。たとえば、/jira から /jira520 への転送には、多数のルールの書き換えが必要になり、このような書き換えのなかには信頼性が保証されないものがある場合もあります。

    The configuration above is for Apache 2.2. In Apache 2.4 you should replace Order deny, allow Allow from all to Require all granted

  5. (任意): 次のようにサイトを有効化します

    # a2ensite jira
    Enabling site jira.
    To activate the new configuration, you need to run:
      service apache2 reload

    (info) これは、デフォルトを利用するのではなく新たなサイトが作成された場合においてのみ必要となります。

  6. Apache の設定をリロードします。
  7. Test by accessing JIRA through Apache, for example http://jira.com or http://atlassian.com/jira.
Windows/その他の OS
Windows/その他の OS 向け解説を詳しく見る
  1. httpd.conf ファイルを見つけて編集します。
  2. Add the following inside the VirtualHost, replacing jiraserver with the hostname of the JIRA server and also modifying the port if required.

    自らのドメインまたはサブドメインへアクセスする場合:

    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /       http://jiraserver:8080/
    ProxyPassReverse        /       http://jiraserver:8080/

    (info) URLの前の/(スラッシュ)を忘れると、プロキシーエラーが発生しますので必ず付け加えてください。

    The configuration above is for Apache 2.2. In Apache 2.4 you should replace Order deny, allow Allow from all to Require all granted

     

    コンテキストパスを利用する場合:

    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /jira       http://jiraserver:8080/jira
    ProxyPassReverse        /jira       http://jiraserver:8080/jira

    (info) 使用するパスは、Tomcat のコンテキスト パスと同一のものである必要があります。たとえば、/jira から /jira520 への転送には、多数のルールの書き換えが必要になり、このような書き換えのなかには信頼性が保証されないものがある場合もあります。

    The configuration above is for Apache 2.2. In Apache 2.4 you should replace Order deny, allow Allow from all to Require all granted

  3. Apache を再起動します。
  4. Test by accessing JIRA through Apache, for example http://jira.com or http://atlassian.com/jira.

ステップ 3: JIRA を設定する

  1. Set Use gzip compression to OFF as in Configuring JIRA Options. GZIP compression is known to cause performance issues using a reverse-proxy, especially if the proxy is also compressing the traffic.
  2. Set the Base URL to be the FQDN that JIRA will be accessed on, for example http://jira.atlassian.com. This is also located in Configuring JIRA Options.
    (warning) JIRA can only be configured to respond to a single URL and the Base URL (as in Configuring JIRA Options) must match the URL end-users are accessing. Misconfiguration of this may cause significant problems within JIRA such as the Activity Stream and Dashboard Gadgets failing to function correctly.
  3. Test by accessing JIRA on the FQDN (e.g.: http://jira.atlassian.com), ensuring that JIRA is accessible and all dashboard gadgets correctly display.

トラブルシューティング

セッションのハイジャック

Some users have reported problems with user sessions being hijacked when the mod_cache module is enabled. If these problems are encountered, try disabling the mod_cache module. 
(info) This module is enabled by default in some Apache HTTP Server version 2 distributions.

Permission Denied Errors enabling mod_proxy (and mod_jk) on Linux distros that use SELinux

Users have reported 'permission denied' errors when trying to get mod_proxy (and mod_jk) working. Disabling SELinux (/etc/selinux/config) apparently fixes this.

 

Mac OS X 使用時の問題

Disable webperfcache, which proxies port 80 by default. A user reported this as the likely cause of JIRA session problems, in the form of users' identities becoming mixed up, as below.
(warning) Additionally we do not recommend using Max OS X as it is not supported, as in our Supported Platforms.

 

The OSX Servers enable webperfcache by default for Virtual Hosts, which for static content would be great, but for dynamic sites (which ALL of ours are) it is Evil and causes many issues. 
Of note recently was the jira session issue. Also see :-
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/webperfcache.8.html
Unfortunately even if you disable webperfcache for a site, if there is a single site enabled then all sites will still proxy through webperfcache with resulting session problems.

過剰なリダイレクト

Both Tomcat & Apache are redirecting, when only one should be. Disable redirection in Tomcat (revert any changes as in Running JIRA over SSL or HTTPS) and check that there is only one redirection in Apache.

その他の一般的なトラブル

  1. ブラウザーのキャッシュを削除してからもう一度試みます。
  2. Ensure that JIRA works as expected when running directly from Tomcat and bypassing Apache. For example, accessing http://jiraserver:8080 instead of http://jira.atlassian.com.
  3. より多くの Apache デバッグ情報を得られるようにログレベルを変更して再起動します。
  4. JIRA にアクセスし、エラーに対応する Apache ログファイル情報を確認します。
  5. アトラシアン Answers に質問を出して助言を求めます。

403 Forbidden エラー

Apache 設定ページに RequestHeader unset Authorization 行を追加して、認証ヘッダーを無効化します。

<Location /jira>
  RequestHeader unset Authorization
  ProxyPreserveHost On
  ProxyPass http://jiraserver/jira
  ProxyPassReverse http://jiraserver/jira
</Location>

参考情報

最終更新日: 2015 年 2 月 9 日

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

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