yuu_nkjm blog
2012-10-31(Wed) 編集
[openSUSE][Apache][Tomcat] ApacheとTomcatの連携 (ajp版.自分の環境ではjk版より実績あり)
以下は,openSUSE 12.2 (64bit)環境で実行した.
apacheモジュールの追加
yast→ /etc/sysconfigエディタ→ Network/WWW/Apache2 → APACHE_MODULESより "proxy proxy_ajp"を追加する.
ロードされたモジュールを確認する.
# apache2ctl -t -D DUMP_MODULES httpd2: apr_sockaddr_info_get() failed for suse-vbox httpd2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName Loaded Modules: core_module (static) mpm_prefork_module (static) http_module (static) so_module (static) actions_module (shared) alias_module (shared) auth_basic_module (shared) authn_file_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_default_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) dir_module (shared) env_module (shared) expires_module (shared) include_module (shared) log_config_module (shared) mime_module (shared) negotiation_module (shared) setenvif_module (shared) ssl_module (shared) userdir_module (shared) reqtimeout_module (shared) proxy_module (shared) proxy_ajp_module (shared) Syntax OK
プロキシの設定
"/etc/apache2/conf.d/mod_proxy_ajp.conf"という設定ファイルを作り,プロキシの設定を書き込む.例えば,以下のようにすると."http://hoge.nkjm.info:8080/manager/"でアクセスできるページに"http://hoge.nkjm.info/manager/"でアクセス出来るようになる.
ProxyPass /manager ajp://localhost:8009/manager ProxyPass /app1 ajp://localhost:8009/app1 ProxyPass /app2 ajp://localhost:8009/app2