Tomcat is a popular open-source web application server known for its powerful features and broad applicability. The management interface of Tomcat contains several buttons, with the Server Status, Manager App, and Host Manager being the most frequently used. This article will introduce the management interface of Tomcat through these three functionalities and explain how to enable them.
Server Status Feature
The Server Status feature is primarily used for monitoring the status of the Tomcat server, including information such as the number of connected users, the number of running threads, and request statistics. By default, this feature is disabled and needs to be enabled by following these steps:
- Open the
conf/tomcat-users.xml
file located in the Tomcat installation directory. - Add the following content within the
<tomcat-users>
tags:
<role rolename="manager-status"/> <user username="admin" password="password" roles="manager-status"/>
Here,manager-status
is a predefined role that allows users to access the Server Status page;admin
andpassword
are the admin username and password, which you can customize. - Save and close the
tomcat-users.xml
file. - Add the following content to the
conf/server.xml
file:
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1" /> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> <Context path="/status" docBase="${catalina.home}/server-status-webapp-1.0.0.war"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> </Context>
Here,/status
is the default access address for the Server Status page, which you may modify as needed;${catalina.home}/server-status-webapp-1.0.0.war
is the web application used to provide the Server Status feature and must be deployed on the Tomcat server. - Save and close the
server.xml
file. - Restart the Tomcat server.
After completing these steps, you can access the Server Status page by navigating to http://localhost:8080/status
in your browser to view various status information about the Tomcat server.
Manager App Feature
The Manager App feature is one of the main tools for Tomcat administrators, assisting in the easy deployment and undeployment of applications, as well as monitoring application statuses. This feature is also disabled by default and requires the following steps to enable:
- Open the
conf/tomcat-users.xml
file located in the Tomcat installation directory. - Add the following content within the
<tomcat-users>
tags:
<role rolename="manager-gui"/> <user username="admin" password="password" roles="manager-gui"/>
Here,manager-gui
is a predefined role that allows users access to the Manager App page;admin
andpassword
are the admin username and password, which can be customized. - Save and close the
tomcat-users.xml
file. - Start the Tomcat server.
- In your browser, enter the address:
http://localhost:8080/manager/html
. - Enter the admin username and password you set previously to access the Manager App page.
Once on the Manager App page, you can perform various management operations such as checking the status of deployed applications, deploying new applications, and uninstalling unnecessary applications.
Host Manager Feature
The Host Manager feature is similar to the Manager App, but its scope is at the host level rather than the application level. With Host Manager, administrators can add, remove, disable, or enable virtual hosts, as well as add or modify virtual host mappings. This functionality is also disabled by default and can be enabled by following these steps:
- Open the
conf/tomcat-users.xml
file located in the Tomcat installation directory. - Add the following content within the
<tomcat-users>
tags:
<role rolename="admin-gui"/> <user username="admin" password="password" roles="admin-gui"/>
Here,admin-gui
is a predefined role that allows users to access the Host Manager page;admin
andpassword
are the admin username and password, which can be customized. - Save and close the
tomcat-users.xml
file. - Start the Tomcat server.
- In your browser, enter the address:
http://localhost:8080/host-manager/html
. - Enter the admin username and password you set previously to access the Host Manager page.
Once on the Host Manager page, you can perform various host management operations such as adding, removing, disabling, or enabling virtual hosts, as well as adding or modifying virtual host mappings.
In summary, the management interface of Tomcat is a highly practical tool that helps administrators easily complete various management tasks. Whether it’s the Server Status, Manager App, or Host Manager functionalities, simple configuration and enabling can unleash their tremendous power in everyday work.