Tomcat Detailed usage learning (v)

Source: Internet
Author: User

This article is followed by a "Tomcat detailed usage Learning (iv)", which mainly explains the management platform of Tomcat server

We might have given a lot of web apps to Tomcat, so the Tomcat server would have to manage our loaded web apps, so where do we get to the Tomcat server management platform? First we start the Tomcat server, go to its homepage, and find the right three "server Status", "Manager App", "Host Manager" Click to enter the password:

  

Password required

So what is the user name and password?

This depends on the "tomcat-users.xml" file in Tomcat's "conf" directory, which is dedicated to configuring Tomcat's administrative users.

In this "tomcat-users.xml" file, there is such a comment (the Green font section):

  

  

The <role> tag describes the role played by the user, and this role is a description of the properties of the <user> tag.

<user> is an administrative user who creates a tomcat server that can log in directly to access without having to write a user name and password, but this is not appropriate for server security management.

Then we will create a user, the user name is: FJDINSD, password is 123, the role is temporarily "guest" good:

<rolename= "Guest1"/><username  = "FJDINGSD"  password= "123"  roles= "Guest1"/>

Note that every time you modify the "Tomcat-users.xml" file, you will have to restart the Tomcat server!

Then we continue to visit, click on the "Manager App", pop-up needs to enter the user name and password:

  

You will find:

  

Yes, access not on ... (Are you kidding me?) )

This is because the creation of the user does not have administrative rights, then how to have administrative rights, the first look at the "Tomcat-users.xml" in the comments of the file in the next line of the example has been given a description, if you want to have administrative rights, then the role of the newly created user ("roles" attribute) The attribute value must be "Manager-gui".

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

<rolename= "Guest1"/><username  = "FJDINGSD"  password= "123"  roles= "Guest1,manager-gui"/> 

By clicking the "Manager App" again and re-entering your username and password, you'll open the door to the New World (-_-!):

  

  

In this case, the applications column below is the respective web apps under the "WebApps" directory in the corresponding Tomcat directory, such as the Web App I created: "MyWebApp":

  

In the command line there are "Start", "Stop", "Reload", "undeploy" These commands, if we can remotely enter the server, we can operate the Web application through the server, such as click "Undeploy", will be my Web application from the " WebApps "directory.

The "War file to deploy" line allows the war files to be transferred from the remote to the Tomcat server, where the server places the received war files in its "WebApps" directory and extracts and runs:

  

Next, the Tomcat server (192.168.1.101) is turned on by my desktop, the notebook packs my web App for war, and uploads it to the Tomcat server, which is then accessed by the laptop side for the newly uploaded web app.

The web App for my notebook is in the directory "Fjweb", which has only one "1.html file":

--->

Make a war package for this web app:

  

Get the "Fjweb.war" package:

  

Then log in to the Tomcat server in the notebook, select "Manager App", enter the user name and password, find "war file to deploy" this, the package of war files just now selected, click "Deploy" to send the file to the Tomcat server, The Tomcat server will be able to manage it automatically:

  

You can see that in application this is the "fjweb" This just uploaded web app:

  

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

But here's a small problem, from the server's directory to this newly uploaded Web application directory, not tomcat to its war package after decompression is the original appearance, but this directory is more than one level:

Click to enter:

In this second "Fjweb" directory is our HTML page, so our remote laptop side access should be entered in the browser two virtual directory path:

  

This explains how to operate and manage the Tomcat server from a remote host.

  

Tomcat Detailed usage learning (v)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.