Home  >  Article  >  Java  >  Graphic tutorial on Tomcat management platform in Java

Graphic tutorial on Tomcat management platform in Java

黄舟
黄舟Original
2017-07-27 15:23:221829browse

This article mainly introduces the relevant information of Tomcat management platform in detail. Explaining the management platform of Tomcat server has certain reference value. Interested friends can refer to it.

We may Many web applications are handed over to Tomcat, so the Tomcat server must manage our loaded web applications. So where do we enter the management platform of the Tomcat server? First, we start the Tomcat server, enter its homepage, and find that the three items on the right side, "Server Status", "Manager App", and "Host Manager", all require a password when clicked:

Password required

So what are the username and password?

This depends on the [tomcat-users.xml] file in Tomcat's [conf] directory. This file is specially used to configure Tomcat's administrative users.

In this "tomcat-users.xml" file, there is such a comment (green font part):

3b3677fa5ae28346828080dc6d333550 tag description The role played by the user, and this role is specified as an attribute of the be1cdaf6779910b92a0a47fc24e82b4f tag.

And be1cdaf6779910b92a0a47fc24e82b4f is to create a management user for the Tomcat server. This user does not need to write a user name and password, and can log in directly for access, but this is not suitable for security management of the server.

Then let’s create a user, the user name is: fjdinsd, the password is 123, and the role is temporarily “guest”:


<role rolename="guest1" />
<user username="fjdingsd" password="123" roles="guest1" />

Note , every time you modify the "tomcat-users.xml" file, you must restart the Tomcat server!

Then let’s continue to visit, click “Manager App”, a pop-up will pop up that requires you to enter your user name and password:

You will find:

Yes, it cannot be accessed. . . (Are you kidding me?)

This is because the created user does not have administrative rights, so how can I have administrative rights? The next line of the comment in the file screenshot in "tomcat-users.xml" that I looked at first The example has already given instructions. If you want the user to have administrative rights, then the role ("roles" attribute) of the newly created user must have the attribute value "manager-gui".

Then add "manager-gui" to the "roles" attribute of the user I just created:


##

<role rolename="guest1" />
<user username="fjdingsd" password="123" roles="guest1,manager-gui" />

At this time, click "Manager App" again , re-enter the user name and password, and the "door to the new world" is opened (-_-!):

In it, under the Applications column is the corresponding Tomcat Each web application in the [webapps] directory in the directory, such as the web application I created: [myWebApp]:

has "Start" and "Stop" in the command line , "Reload", "Undeploy" these commands, if we can remotely enter the server, we can operate the web application through the server. For example, clicking "Undeploy" will delete my web application from the [webapps] directory. .

The "WAR file to deploy" line allows the war file to be transferred to the Tomcat server remotely. The server will place the received war file in its [webapps] directory, decompress it and run it:

Next, my desktop will open the Tomcat server (192.168.1.101), my laptop will war-package my web application, and upload it to the Tomcat server, and finally The laptop accesses the web application just uploaded.

The directory where my laptop's web application is located is [fjweb], and there is only one "1.html file" in this directory:

For this web application Pack the war:

Get the "fjweb.war" package:

Then log in to the Tomcat server on the laptop, Select "Manager App", enter the user name and password, find the "WAR file to deploy" item, select the war file you just packaged, click "Deploy" to send the file to the Tomcat server, and the Tomcat server will automatically Managed it:

You can see that the newly uploaded web application "fjweb" is added to the Application item:

Then we can Continue to access it from the laptop side.

But there is still a small problem here. From the directory where the server is located to the web application directory just uploaded, it is not that Tomcat decompresses its war package and it is the original look, but that there are many more directories. Up one level:

Click in:

In this second [fjweb] directory is our html page, so our access on the remote notebook side should Enter the virtual directory path twice in the browser:

Here we introduce how to operate and manage the Tomcat server from the remote host.

The above is the detailed content of Graphic tutorial on Tomcat management platform in Java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn