【Tomcat】Tomcat Webアプリケーションマネージャ

Tomcat Webアプリケーションマネージャとは?

 * TomcatGUI管理ツール

どんな事ができる?

[[http://localhost:8080/manager/html/list]]
[a-1] どんなアプリケーションが起動中か・セッション数を一覧表示
[a-2] WARファイルの配備(デプロイ)
[a-3] メモリリークの診断(Diagnostics)を実行
[a-4] サーバ情報(Tomcat/Javaのバージョンなど)を表示
[[http://localhost:8080/manager/status]]
[b-1] JVM(Java仮想マシン)のメモリ設定(Memory Pool/Type/Initial/Total/Maximum/Used)

■ 設定

設定環境

 * OS : Windows10
 * Java : Java v1.8.0-b132
 * Tomcat : Apache Tomcat v9.0.0.M26

設定手順

[1] $CATALINA_HOME/conf/tomcat-users.xml にユーザを追加する
 => 以下「【設定例】$CATALINA_HOME/conf/tomcat-users.xml」の「修正後」を参照のこと。

[2] Tomcat を(再)起動

[3] ブラウザで以下のアドレス(デフォルト設定時)にアクセスする
 => 認証ダイアログが表示されるので、
    [1]で設定したユーザ名、パスワード(今回は「tomcat」「password」)を入力し、OKボタン押下
  => 「Tomcat Webアプリケーションマネージャ」画面が表示されればOK!
[[http://localhost:8080/manager/html]]

【設定例】$CATALINA_HOME/conf/tomcat-users.xml

* 設定例として、Webアプリケーションマネージャのユーザ名、パスワード、ルールを以下のように設定
ユーザ名 :tomcat
パスワード:password
ルール  :manager-gui
修正前
・・・略・・・
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  application.
-->
・・・略・・・
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
</tomcat-users>
修正後
・・・略・・・
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary. It is
  strongly recommended that you do NOT use one of the users in the commented out
  section below since they are intended for use with the examples web
  application.
-->
・・・略・・・
<!-- Add -->
<role rolename="manager-gui"/>
<user username="tomcat" password="password" roles="manager-gui"/>
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
</tomcat-users>

補足:Tomcat7以前

以下を追記する
<!-- ここ追記 -->
<role rolename="manager" />
<role rolename="admin" />
<user username="admin" password="tomcat" roles="manager,admin" />

■ トラブルシュート

 * 「403 Access Denied」が返ってくる場合は、以下の関連記事を参照のこと。
https://blogs.yahoo.co.jp/dk521123/37329976.html


関連記事

Tomcat Webアプリケーションマネージャで「403 Access Denied」が返ってくる

https://blogs.yahoo.co.jp/dk521123/37329976.html

TomcatTomcat管理ツール Probe

https://blogs.yahoo.co.jp/dk521123/37341093.html