Download, install and configure Tomcat

Download, install and configure Tomcat

The blog post will describe the detailed process of downloading, installing and configuring Tomcat. I hope it will be helpful to you. If there are any mistakes or deficiencies, please criticize and correct! !

1. Introduction to Tomcat

insert image description here

Tomcat (full name Apache Tomcat) is an open source, lightweight web application server and an important project of the Apache Software Foundation. It implements Java technical specifications such as Java Servlet, JavaServer Pages (JSP) and WebSocket, and provides an environment for running Java Web applications.
Key features and functions of Tomcat include:

  1. Servlet and JSP container: As a Web server, Tomcat can interpret and execute Java Servlet and JSP codes, process HTTP requests and responses, and generate dynamic Web pages.
  2. Independence and ease of use: Tomcat is an independent server that can run independently or in combination with other HTTP servers (such as Apache HTTP Server). It provides an easy-to-use management interface for configuring and managing web applications.
  3. Lightweight and high performance: Tomcat has a simplified design, occupies less resources, and is fast to start and deploy. It has good concurrent processing capabilities and high throughput, and is suitable for scenarios that handle a large number of requests.
  4. Security: Tomcat provides a variety of security mechanisms, including role-based access control, SSL/TLS encryption, authentication and authorization, etc., to protect the security of Web applications.
  5. Extensibility: Tomcat supports the use of plug-ins to extend its functions, such as adding additional connectors, using custom authentication mechanisms, adding additional data sources, etc.
  6. Connector and protocol support: Tomcat supports a variety of connectors and protocols, including HTTP, HTTPS, AJP (Apache JServ Protocol), etc., and can be integrated with different front-end servers and back-end applications.

Tomcat is widely used in the field of Java Web development. It provides a reliable and stable operating environment for developers to deploy and run Java Web applications. Whether developing small websites or large enterprise applications, Tomcat is a common choice.

2. Download and install Tomcat

Enter tomcat official website, Tomcat official website

1. Select the version you want to download and click Download

The download path must be remembered, and try not to have Chinese in the path
8, 9, and 10 are all available, this blog post takes 8 as an example
insert image description here
insert image description here

2. Unzip the downloaded installation package to the specified location

insert image description here

3. The folder directory structure of Tomcat is as follows:

  1. binDirectory: Contains Tomcat executable files, such as startup and shutdown scripts.
  2. confDirectory: Contains configuration files of Tomcat, such as server configuration, web application configuration, log configuration, etc. Important files include server.xml(server configuration), web.xml(web application configuration), etc.
  3. libDirectory: Contains Java class library files (JAR files) required for Tomcat to run, as well as some extended class libraries. Among them, catalina.jaris the core class library of Tomcat.
  4. logsDirectory: Contains Tomcat log files, such as access logs, error logs, etc.
  5. webappsDirectory: It is the location where the web application is stored. When deploying a web application to Tomcat, the WAR file of the application is usually placed in this directory, and Tomcat will automatically decompress and deploy it.
  6. workDirectory: It is the working directory of Tomcat, which is used to store temporary files and compiled Servlet class files.
  7. tempDirectory: It is the temporary file directory of Tomcat, which is used to store temporarily generated files.
  8. conf/CatalinaDirectory: Contains specific web application configuration files. In this directory, each Web application deployed on Tomcat has a corresponding subdirectory named the host name of the application.
  9. conf/Catalina/localhostDirectory: Used to store context configuration files (eg ) for specific web applications context.xml. Every web application deployed on Tomcat has a corresponding XML file.

The directory structure of these folders and files provides support such as configuration, class libraries, logs, and temporary files that Tomcat needs to run. Understanding the meaning and function of these directories can help you better understand and manage Tomcat server.

4. Test verification

Open to the bin directory, double-click the startup.bat file [startup file under the windows operating system],
insert image description here
open the browser, and enter in the address bar: [http://localhost:8080] or [http://127.0.0.1:8080]
If you see a JSP page that comes with Tomcat, it means that the installation is successful.
8080 is the default port number. If it conflicts with other software, just modify the port number in server.xml in the configuration file.
insert image description here

5. Possible problems

1. There is no java environment configured

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

Then you need to download and configure java: JDK download installation and configuration

2. Garbled characters

Go to the conf directory, find the logging.properties file
insert image description here
about 47 lines, modify the encoding to GBK, and restart.
insert image description here

3. Start flashback

A black window flashes past: reconfigure environment variables

3. Configure environment variables

insert image description here
2. Double-click Path, New-Write-Complete

写入:%CATALINA_HOME%\bin

insert image description here

Click OK after completion, the configuration of the Tomcat environment variable is complete

Guess you like

Origin blog.csdn.net/AN_NI_112/article/details/131480465