ubuntuにApacheとTomcatをインストールして連携させる

1.ubuntuを起動
2.Apache2をインストール


Ubuntu Software Centerを開く
”apache2”で検索
Apache HTTP Server metapackage をinstall
3.TOMCATをインストール

Ubuntu Software Centerを開く
tomcat”で検索
Servlet and JSP engine をinstall
Servlet and JSP engine -- admin web applications をinstall
Servlet and JSP engine -- tools to create user instances をinstall
Servlet and JSP engine -- example web applications をinstall
Servlet and JSP engine -- documentation をinstall

ブラウザで”http://localhost:8080/”に接続することを確認

4.WEBアプリケーションマネージャを設定

/etc/tomcat6/tomcat-user.xml節を次のように書き換える




サービスを再起動
$ sudo service tomcat6 restart

ブラウザで”http://localhost:8080/manager/html”に接続することを確認

5.Apache2とTOMCATを連携


プロキシを起動
$sudo a2enmod proxy
$sudo a2enmod proxy_ajp

/etc/tomcat6/server.xml を開く
8080ポートを塞ぐ
<!--

-->

8009ポートを開く
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!-- -->

ProxyPass ajp://localhost:8009/


ProxyPass ajp://localhost:8009/manager/html


ProxyPass ajp://localhost:8009/host-manager/html


ProxyPass ajp://localhost:8009/dsudo service tomcaocs


ProxyPass ajp://localhost:8009/examples


ProxyPass ajp://localhost:8009/examples/jsp


ProxyPass ajp://localhost:8009/examples/servlets

プロキシを可能にする
/etc/apache2/mods-available/proxy.conf を開く
#Deny from all ←コメントアウト
Allow from all ←追加

TOMCATApacheの順にサービスを再起動
$ sudo service tomcat6 restart
$ sudo service apache2 restart

ブラウザで
http://localhost
http://localhost/manager/html
に接続することを確認