The article directories
- Tomcat profile
- Tomcat download
- Tomcat directory Structure
- Tomcat installation
- The Tomcat port is occupied
-
- 1.Tomcat changes the port number
- 2. End the process of the occupied port
- Tomcat change code
Tomcat profile
- Tomcat is a Servlet container developed by Apache, which implements support for servlets and JSPS and provides some unique functions as a Web server, such as Tomcat management and control platform, security domain management and Tomcat valve.
- Since Tomcat itself includes an HTTP server, it can also be considered a separate Web server. However, Tomcat should not be confused with Apache HTTP server, which is an HTTP Web server implemented in C language. The two HTTP Web Servers are not bundled together. Tomcat includes a configuration management tool and can also be configured by editing configuration files in XML format.
Tomcat download
Tomcat download and installation: blog.csdn.net/qq_41684621…
Tomcat directory Structure
Directory name | Directory role |
---|---|
bin | Stores the script files used to start and stop Tomcat on Windows or Linux |
conf | Stores various global configuration files for the Tomcat server, the most important of which are server.xml and web.xml |
lib | Store the library files required for Tomcat operation |
logs | Stores log files for Tomcat execution |
webapps | Tomcat’s main Web publishing directory |
work | Store the class file generated after JSP compilation |
temp | The temporary directory |
Tomcat installation
- Do not install the software in a Chinese directory. Then find startup.bat in the bin directory.
- The startup port is 8080, and the startup time is 3481 ms. Then the browser accesses localhost:8080 to check whether the installation is successful.
The Tomcat port is occupied
- Port occupied is a very common error in development. If the first program using port 8080 is not closed and Tomcat is run again using port 8080, an error is reported that the Tomcat port has been used.
- Any program running need to use the port, when the port has been used, start error. The following solutions are as follows: Modify the port. End the process that occupies the port.
1.Tomcat changes the port number
- Go to the tomcat conf/server. XML configuration file and modify the following:Change 8005 to 8010
- Start tomcat for port 8010:
2. End the process of the occupied port
Refer to this blog post I wrote: Windows solves the problem of occupied ports
Tomcat change code
- The default encoding format after Tomcat8 is
utf-8
; Everything before 7iso8859-1
If, by default, Tomcat uses the following encoding:iso8859-1
, modify tomcatconf/server.xml
File. Find the following code:
<Connector port="8080" protocol="HTTP / 1.1" connectionTimeout="20000" redirectPort="8443" />
Copy the code
- This code specifies information such as the port number on which Tomcat listens for HTTP requests.
- You can add an attribute here:
URIEncoding
, sets the property value toUTF-8
To have Tomcat (default ISO-8859-1 encoding) process GET requests in UTF-8 encoding. - After modification:
<Connector port="8080" protocol="HTTP / 1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
Copy the code