19.6.3. Apache HTTP Server への mod_jk モジュールのインストール (ZIP)
前提条件
- このタスクを実行するには、サポートされる環境にインストールされた Apache HTTP Sever を使用するか、JBoss Enterprise Web Server にインストールされた Apache HTTP Sever を使用する必要があります。JBoss Enterprise Web Server にインストールされた Apache HTTP Sever は JBoss EAP 6 ディストリビューションの一部であることに注意してください。
- Apache HTTP Server をインストールする必要がある場合は、『Red Hat Enterprise Linux デプロイメントガイド (Red Hat Enterprise Linux Deployment Guide)』 に記載された手順を実行します。
- JBoss Enterprise Web Server をインストールする必要がある場合は『JBoss Enterprise Web Server インストールガイド (JBoss Enterprise Web Server Installation Guide)』 に記載された手順を実行します。
- Apache HTTP Server を使用する場合は、ご使用のプラットフォーム向けの JBoss EAP 6 ネイティブコンポーネントパッケージを Red Hat カスタマーサービスポータル (https://access.redhat.com) からダウンロードします。このパッケージには、Red Hat Enterprise Linux 向けにプリコンパイルされた
mod_jkおよびmod_clusterバイナリーが含まれます。JBoss Enterprise Web Server を使用している場合は、すでにmod_jkのバイナリーは含まれています。 - Red Hat Enterprise Linux (RHEL) 5 と Apache HTTP サーバー (httpd 2.2.3) を使用している場合は、mod_jk モジュールをロードする前に mod_perl モジュールをロードしてください。
- 管理 (root) 権限を使用してログインする必要があります。
手順19.11 mod_jk モジュールのインストール
mod_jk モジュールを設定します。
HTTPD_HOME/conf.d/mod-jk.confという名前の新しいファイルを作成し、以下の内容をそのファイルに追加します。注記
JkMountディレクティブは、Apache が mod_jk モジュールに転送する必要がある URL を指定します。ディレクティブの設定に基づいて、mod_jk は受け取った URL を正しいサーブレットコンテナーに転送します。静的なコンテンツを直接提供し、Java アプリケーションにのみロードバランサーを使用するには、URL パスが/application/*である必要があります。mod_jk をロードバランサーとして使用するには、値/*を使用してすべての URL を mod_jk に転送します。# Load mod_jk module # Specify the filename of the mod_jk lib LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile conf/workers.properties # Where to put jk logs JkLogFile logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicates to send SSK KEY SIZE JkOptions +ForwardKeySize -ForwardDirectories # JkRequestLogFormat JkRequestLogFormat "%w %V %T" # Mount your applications # The default setting only sends Java application data to mod_jk. # Use the commented-out line to send all URLs through mod_jk. # JkMount /* loadbalancer JkMount /application/* loadbalancer # Add shared memory. # This directive is present with 1.2.10 and # later versions of mod_jk, and is needed for # for load balancing to work properly JkShmFile logs/jk.shm # Add jkstatus for managing runtime data <Location /jkstatus/> JkMount status Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
値を見て、セットアップに適切であることを確認します。適切な場合は、ファイルを保存します。JKMountFile ディレクティブの指定
mod-jk.confの JKMount ディレクティブに加えて、mod_jk に転送される複数の URL パターンを含むファイルを指定できます。- 以下の内容を
HTTPD_HOME/conf/mod-jk.confファイルに追加します。# You can use external file for mount points. # It will be checked for updates each 60 seconds. # The format of the file is: /url=worker # /examples/*=loadbalancer JkMountFile conf/uriworkermap.properties
- 照合される各 URL パターンに対する行を含む
HTTPD_HOME/conf/uriworkermap.propertiesという名前の新しいファイルを作成します。以下の例は、ファイルの構文の例を示しています。# Simple worker configuration file /*=loadbalancer
httpd のモジュールディレクトリーへの mod_jk.so ファイルのコピー
注記
これは Aache HTTP Server のmodules/ディレクトリーにmod_jk.soがない場合のみ必要となります。JBoss EAP 6 のダウンロードとして含まれている Apache HTTP Server を使用している場合はこの手順を省略できます。Native Web Server Connectors Zip パッケージを展開します。オペレーティングシステムが 32 ビットの場合はEAP_HOME/modules/system/layers/base/native/lib/httpd/modules/ディレクトリー、64 ビットの場合はEAP_HOME/modules/system/layers/base/native/lib64/httpd/modules/ディレクトリーにあるmod_jk.soファイルを見つけます。このファイルをHTTPD_HOME/modules/ディレクトリーにコピーします。
mod_jk ワーカーノードを設定します。
HTTPD_HOME/conf/workers.propertiesという名前の新しいファイルを作成します。以下の例を土台として使用し、必要に応じてファイルを変更します。# Define list of workers that will be used # for mapping requests worker.list=loadbalancer,status # Define Node1 # modify the host as your host IP or DNS name. worker.node1.port=8009 worker.node1.host=node1.mydomain.com worker.node1.type=ajp13 worker.node1.ping_mode=A worker.node1.lbfactor=1 # Define Node2 # modify the host as your host IP or DNS name. worker.node2.port=8009 worker.node2.host=node2.mydomain.com worker.node2.type=ajp13 worker.node2.ping_mode=A worker.node2.lbfactor=1 # Load-balancing behavior worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=node1,node2 worker.loadbalancer.sticky_session=1 # Status worker for managing load balancer worker.status.type=status
workers.propertiesファイルの構文と高度な設定オプションの詳細については、「Apache Mod_jk ワーカーの設定リファレンス」を参照してください。
Web サーバーを再起動します。
Web サーバーの再起動の方法は、Red Hat Enterprise Linux の Apache HTTP Server を使用しているか、または JBoss Enterprise Web Server に含まれる Apache HTTP Server を使用しているかによって異なります。以下の方法の 1 つを選択します。Red Hat Enterprise Linux の Apache HTTP Server
以下のコマンドを実行します。[root@host]#
service httpd restartJBoss Enterprise Web Server の Apache HTTP Server
JBoss Enterprise Web Server は、Red Hat Enterprise Linux と Microsoft Windows Server の両方で実行されます。Web サーバーを再起動する方法はそれぞれ異なります。RPM からインストールされた Red Hat Enterprise Linux
Red Hat Enterprise Linux では、JBoss Enterprise Web Server は Web サーバーをサービスとしてインストールします。Web サーバーを再起動するには、以下の 2 つのコマンドを実行します。[root@host ~]# service httpd stop [root@host ~]# service httpd start
Zip からインストールされた Red Hat Enterprise Linux
Zip アーカイブから JBoss Enterprise Web Server Apache HTTP Server をインストールした場合は、apachectlコマンドを使用して Web サーバーを再起動します。EWS_HOME は、JBoss Enterprise Web Server Apache HTTP Server を展開したディレクトリーに置き換えてください。[root@host ~]# EWS_HOME/httpd/sbin/apachectl restart
Microsoft Windows Server
コマンドプロンプトで以下のコマンドを管理権限で実行します。C:\> net stop Apache2.2 C:\> net start Apache2.2
Solaris
コマンドプロンプトにて、以下のコマンドを管理者権限で実行します。EWS_HOME は、JBoss Enterprise Web Server Apache HTTP Server を展開したディレクトリーに置き換えてください。[root@host ~] EWS_HOME/httpd/sbin/apachectl restart
Apache HTTP Server が mod_jk ロードバランサーを使用するよう設定されます。JBoss EAP 6 が mod_jk を認識するよう設定するには、「外部 Web サーバーからの要求を許可するよう JBoss EAP 6 を設定」を参照してください。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.