How to add an administrator to the tomcat server

Tomcat is popular among programmers because of its open source, free, low system resources, good scalability, support for load balancing and mail services and other functions commonly used in development application systems. In order to better manage tomcat servers, we usually A user administrator will be added to tomcat so that you can log in to view the published project. For beginners, you need to be familiar with the principle of tomcat project release.


Tomcat is a core project in the Jakarta project of the Apache Software Foundation, developed by Apache, Sun, and other companies and individuals. With the involvement and support of Sun, the latest Servlet and JSP specifications are always reflected in Tomcat, and Tomcat 5 supports the latest Servlet 2.4 and JSP 2.0 specifications. Because of its advanced technology, stable performance, and free of charge, Tomcat is loved by Java enthusiasts and recognized by some software developers, becoming the most popular web application server. The latest version is 7.0.


Step / method


Step 1: First, we will check the installation directory of the tomcat. Here I use the unzipped version of tomcat, do not need to install it, you can use it after decompression. I suggest you use this version.

4841217_20140527151343[1].png

Step 2: Then we enter the bin directory, find the startup.bat in the bin directory, and click to start tomcat.

4841217_20140527151352[1].png

Step 3: Click startup.bat to start the tomcat service. Wait a moment.

4841217_20140527151404[1].png

Step 4: The server does not report an error, indicating that the project is successfully published. Just put the project you want to send to the webapps directory in tomcat, and the tomcat server will automatically publish the project. Now the Mail project has been released online.


Step 5: Open your browser. Here I use Google Chrome to explain: access tomcat home page: If your tomcat can access the home page, then your tomcat configuration is successful.

4841217_20140527151418[1].png

Step 6: Click on Tomcat Manager and you will be prompted to log in. Here I have configured the user management of tomcat: enter the username and password.


Step 7: After we click OK, we can enter the project that has been released by Tomcat, which is the project below tomcat webapps. Here our tomcat webapps directory is an example project, as shown below:

4841217_20140527151449[1].png

Step 8: This time let us see how tomcat is configured to add management users:


Step 9: Click on -config in the unzipped directory of tomcat, then edit tomcat-users.xml

4841217_20140527151458[1].png

Step 10: Then add the following sentence to tomcat-users.xml:

4841217_20140527151511[1].png

Step 11: After restarting tomcat, your tomcat can log in using admin. Test the effect!