Installation and configuration of tomcat under windows

 

1. Download the corresponding JDK and tomcat versions

 

JDK:jdk-8u131-windows-x64

 

tomcat:apache-tomcat-8.5.23-windows-x64.zip

 

Second, the installation of JDK

 

Please refer to:

 

Three, tomcat installation

 

Step 1: Download apache-tomcat-8.5.23-windows-x64.zip from the official website, download address: https://tomcat.apache.org/whichversion.html

 

Step 2: Press the downloaded file to the specified directory (here I installed it on the C drive), and change the name to tomcat, as shown below:

 

Step 3: Configure Tomcat environment variables

 

Computer → Properties → Advanced System Settings → Advanced → Environment Variables

 

Add the following variables in system variables

 

1) Create a new TOMCAT_HOME variable

 

variable name TOMCAT_HOME

 

The variable value is C:\Program Files\tomcat (the variable value is the tomcat decompression path we downloaded, here is c:\tomcat)

 

 

2) Create a new CATALINA_HOME variable

 

Variable name CATALINA_HOME

 

Variable value C:\Program Files\tomcat

 

Yes, the variable value of CATALINA_HOME is the same as the variable value of TOMCAT_HOME.

 

 

 

3) Modify the variable Path

 

Find the Path variable name in the system variables, double-click or click to edit, and add the following at the end

 

;%TOMCAT_HOME%\bin;%CATALINA_HOME%\lib

 

It should be noted here that each variable value must be separated by ;.

 

 

4) Start the Tomcat server

 

Enter startup and press Enter in the cmd command window, and run as shown in the following figure

 

 

Step 4: Test whether the Tomcat server is successfully installed

 

Enter http://localhost:8080 or http://127.0.0.1:8080 in your browser

 

The installation will be successful as shown below

 

 

Step 5: Finally, configure the UTF-8 encoding of tomcat:

Open the Tomcat installation directory configuration file directory: D:\apache-tomcat-7.0.65\conf\server.xml

Open the server.xml file and modify this section (
Added URIEncoding="UTF-8", useBodyEncodingForURI="true", modified connectionTimeout="60000"):
 
  
  1. <Connector URIEncoding="UTF-8" port="8080" protocol="HTTP/1.1"
  2. connectionTimeout="60000"
  3. redirectPort="8443" useBodyEncodingForURI="true"/>
 
Step 6: Modify the release path of the project in eclipse (optional)

If you deploy the project by default in eclipse, you will find that the published project cannot be found in the webapps directory of Tomcat, but in the workspace directory of eclipse

D:\Workspaces\eclipse_luna\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps

 

 

 Modify the publish properties of Tomcat in eclipse. Double-click [Tomcat v7.0 Server at localhost-1]---[Server Locations]---Select the project deployment path---[Deploy path]--Set the folder for project deployment

 

 

 

① If the configuration is the first item, deploy the project to the workspaces directory, so that eclipse will automatically copy a Tomcat in the temporary directory. The advantage of this is that it will not affect our installed tomcat and is relatively safe. The disadvantage is that the path is relatively long.
② If the configuration is the second item, deploy the project to the installation directory of tomcat, usually in the webapps directory under the installation directory of tomcat. The disadvantage of this is that all projects share a common tomcat, which may be unstable. The advantage is that the path is shorter and easier to find.
③ If it is configured as the third item, deploy the project to a custom directory. The advantages and disadvantages are currently unknown.
Generally, development individuals are accustomed to using the first configuration.

 

At this point, the Tomcat installation and configuration is complete.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326015814&siteId=291194637