Table of contents
1. Tomcat is the first way to deploy web projects
The first deployment method: just copy the directory of the web project to the webapps directory of Tomcat
1. Create a project in the webapps directory:
Here we create a folder player
Then copy the content of a web project into it (the content of an html web page is used here)
So far the project has been deployed.
2. How to access the web project under Tomcat:
Just enter the access address format in the browser as follows:
- http://localhost:8080/project name/directory/file name
- http://ip address of computer: 8080/project name/directory/file name
Here we try to access the Home.html page in the web project
Type in your browser:
- http://localhost:8080/player/Home.html
- http://192.168.1.115(my ip address)/:8080/player/Home.html
Note here:
webapps under the tomcat path are equivalent to http://localhost:8080 of the access path
Successful visit! !
![Insert picture description here](https://img-blog.csdnimg.cn/b9dd11737e92451c9fac5427395026b2.png 500x)
If it is a LAN, you can try the following to access the project webpage deployed by the server in the same LAN (I am a computer Even mobile phones can access wifi)
Note: If it is connected by wifi, the computer ip should select the ip address in the wireless LAN adapter WLAN
2. Tomcat The second way to deploy web projects
The first deployment method: find the conf\Catalina\localhost\ under Tomcat, and create the following configuration file (create an xml file):
The content format in the abc.xml file is as follows:
it is equivalent to mapping the path E:\Html\player to the path /abc
Note: the path is /docBase is \
because /abc is needed when accessing in the browser, browse The path in the browser is separated by /
and the path in the computer is separated by \
After configuring the xml file, the project deployment task is completed.
Note: After modifying the xml file, you need to restart the Tomcat server, which may or may not have any effect.
How to access the web project under Tomcat:
The path to access this project is as follows:
http://localhost:8080/abc/
http://computer ip address/abc/
It means accessing the E:\Html\player directory
After configuring the above requirements, use the second deployment method to access the web project.
(Take access to Home.html in the player directory as an example. The path of Home.html is as follows)
The path to access this web is: http://localhost:8080/abc/Home.html
Successful visit!