1. Introduction to tomcat service management page manager
Tomcat's management page Manager is a web application for managing the deployment and operation of Tomcat servers. It provides an easy-to-use interface that can be accessed through a web browser. Manager can help administrators to perform the following operations on the Tomcat server:
- Deploy/uninstall web applications
- View the running status and statistics of web applications
- Start/stop web application
- View the status and operation logs of the Tomcat server
- Manage Tomcat server users and roles
- Configure Tomcat server security and access control
Through Manager, administrators can easily manage multiple web applications of Tomcat server, and can add, delete or update these applications as needed. It also provides useful tools such as a log viewer and a web application monitor that can help administrators better understand the performance and health of the Tomcat server.
2. Configuration steps
This blog post takes the installation and configuration of tomcat8.5.87 in the centos7.6 environment as an example.
1. Download tomcat
(base) [wuhs@s142 ~]$ wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.87/bin/apache-tomcat-8.5.87.tar.gz
2. Unzip tomcat
(base) [wuhs@s142 ~]$ tar -zxvf apache-tomcat-8.5.87.tar.gz
(base) [wuhs@s142 ~]$ ln -s apache-tomcat-8.5.87 tomcat8
3. Start the tomcat service
(base) [wuhs@s142 tomcat8]$ ./bin/startup.sh
4. Modify the login source address restriction
Modify the following two files, and change the following parameter allow="127.\d+.\d+.\d+|::1|0:0:0:0:0:0:0:1" to allow="192.168. 0.x" or allow="^.*$". It is recommended that only trusted source hosts be allowed to access. If there are multiple trusted source hosts, use | to separate them.
(base) [wuhs@s142 tomcat8]$ vim webapps/manager/META-INF/context.xml
(base) [wuhs@s142 tomcat8]$ vim webapps/host-manager/META-INF/context.xml
5. Configure login account and password
Configure the tomcat-users.xml file, add the following lines in the tomcat-users component, and set the administrator role and account password. Among them, manager-gui is the role required to view the server status, and admin-gui is the role required to view host-manager.
(base) [wuhs@s142 tomcat8]$ vim conf/tomcat-users.xml
…
<role rolename=“manager-gui”/>
<role rolename=“manager-jmx”/>
<role rolename=“manager-status”/>
<role rolename=“admin-gui”/>
<role rolename=“admin-script”/>
<role rolename=“manager-gui”/>
<user username=“admin” password=“admin” roles=“manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script”/>
Each role is described as follows:
- manager-gui: Allows users to manage Tomcat servers through a web interface. This role can view the list of applications, start and stop applications, and view the current state of Tomcat.
- manager-script: Allows users to manage Tomcat servers through scripts or command lines. This role can perform the same operations as manager-gui, but via script or command line.
- manager-jmx: Allows users to manage Tomcat servers through Java Management Extensions (JMX). This role can view and modify Tomcat's runtime state, including thread pool, JVM parameters, and memory usage.
- manager-status: Allows users to view the running status of the Tomcat server. This role can view the current status of Tomcat, including memory usage, thread pool and connection pool, etc.
- admin-gui: Allows users to manage the global configuration of the Tomcat server through the web interface. This role can view and modify Tomcat's global configuration, including ports, SSL certificates, and security settings.
- admin-script: Allows users to manage the global configuration of the Tomcat server through scripts or command lines. This role can perform the same operations as admin-gui, but via script or command line.
6. Set the service port
The default service port of tomcat is 8080, you can customize the port, and specify the listening port according to the server port planning settings.
7. Visit the tomcat page
8. Log in to the management page
Click on the management items such as Server Status and Manager App to pop up a window to ask for the user password. After entering the set user name and password, you can log in.
9. View server status
Check the server status to see the java version, operating system kernel version, memory usage and other information.
10. WEB application management
WEB application management can manage the start and stop of various services under the webapp, reload configuration, update deployment, etc.
11. The host-manager page
The main purpose of the Tomcat virtual host administrator is to manage virtual hosts on the Tomcat server. Virtual hosting refers to running multiple websites on the same server. Each website has its own domain name and IP address, but they share the same server resources. Virtual host administrators can create, configure and manage virtual hosts through the Tomcat virtual host management tool, including setting the domain name, IP address, port number, SSL certificate, etc. of the virtual host. In addition, the virtual host administrator can also monitor the running status of the virtual host, view the access log of the virtual host, clear the cache of the virtual host, and so on. Through the Tomcat virtual host administrator, enterprises can manage and utilize server resources more flexibly, and improve the usability and performance of the website.
3. QA
1. Error 403 is reported when accessing the manager page
-
error message
-
The reason for the error is that
the manager page only allows local browser access by default, and the access source address is limited to 127.0.0.1
-
Solution
Change the source address to a trusted address (recommended) or any address to allow remote access to the manager.
Refer to step 4 in the configuration steps.
2. Error 403 is reported when accessing the host-manager page
- error message
- Reason for error
No permission to access this page - Solution
Set the account role and authorize it.
Refer to step 5 in the configuration steps.