[Tool Series 1] -- basic configuration of Tomcat and basic configuration of tomcat

Source: Internet
Author: User

[Tool Series 1] -- basic configuration of Tomcat and basic configuration of tomcat

Tomcat is the most famous open-source Web container in the Java field and is also the most commonly used Web server. We need to understand its basic configurations.

The configuration described in this blog is based on the apache-tomcat-6.0.43 version.

 

Tomcat: http://tomcat.apache.org/


Directory description

Directory structure on windows:

Bin: The Path to the Tomcat command.

Conf: Tomcat configuration

Lib: Core class library, third-party class library storage path (extends the Tomcat function)

Logs: stores logs generated after each operation

Temp: temporary file generated during web application running

Webapps: web Application Deployment path

Work: compiled class files


Basic Configuration

The basic configuration of Tomcat is summarized as follows:


Web Service port settings: change the configuration in the conf/server. xml file.

    <Connectorport="8080" protocol="HTTP/1.1"              connectionTimeout="20000"               redirectPort="8443"/>


Console:

When you click Status and Tomcat Manager on the Tomcat homepage, you must enter the user name and password. The username and password information here is saved in the conf/tomcat-users.xml file, note that you need to associate a specific role when saving user information (Tomcat provides graphic interface control in the form of a web application, its role information can be viewed by webapps/manager/WEB-INF/web. 123 rows in the xml file-167 rows)

Because the console Status and TomcatManager access html/*, status/* resources, you can configure the manager-gui role for the new user in the tomcat-users.xml:

       <rolerolename="manager-gui" />       <userusername="admin" password="admin"roles="manager-gui" />
Restart Tomcat and enter the user name and password after clicking the view console button.

 

Deploy Web applications:

Web applications can be directly copied to the webapps path to complete automatic deployment. Other deployment methods can be implemented by readers.

 

DataSource:

Because the efficiency of obtaining connections from the database is relatively slow, we can create a batch of connections in the connection pool in advance. When the application performs database operations, we can directly obtain connections from the connection pool, this improves efficiency.

DBCP -- DataBaseConnection pool, a database connection pool, is a java connection pool project on apache that is built into Tomcat and can be used by Web applications. It has global and local features, that is, it is differentiated by whether all Web applications are accessed.


Summary

Due to its simplicity, ease of use, and stability, Tomcat has become the most famous open-source Web container in the Java field. At the same time, we also need to have a basic understanding of its configuration during application, this makes it easier to use the tool.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.