Tomcat deployment project, modify port and understand

How the project is deployed

Method 1:
Put the project directly in the webapps directory under the tomcat folder

Method 2
Configure in conf/server.xml under the tomcat folder and add in the host tag:

<Context docBase="E:\Program\JspProject" path= "/JspProject" />

Then restart tomcat

docBase: actual path
path: virtual path (absolute path, relative path [relative to webapps])

Method three
directly create a new " project name.xml" in E:\Program\apache-tomcat-9.0.22\conf\Catalina\localhost and add it

<Context docBase="E:\Program\JspProject" />

Access through the project name of "project name.xml".
If you don't want to deploy this project, add "_bak" after "project name.xml" and the server will not find the project.

No need to restart tomcat

Modify port number

The tomcat port number is 8080 by default (this port is more common and easy to conflict). It is recommended to modify the port number.
Modify the port number: open the folder conf, open server.xml, in line 69, modify it to other (such as 8888) and save it.

Understanding of tomcat folder

bin: executable file (startup.bat shutdown.bat)
conf: configuration file (server.xml)
lib: jar file that tomcat relies on
log: log file (record error and other information)
temp: temporary file
webapps: executable project ( Put the project we developed into this directory)
work: store the java translated into jsp and the edited class file (jsp->java->class)

Directory structure of java dynamic project:

Insert picture description here

Common status codes

300/301: Page redirection (jump)
403: Insufficient authority
404: Resource does not exist
500: Server internal error (wrong code)

Guess you like

Origin blog.csdn.net/qq_42524288/article/details/103308904