Tomcat default program release path to use and modify the method
- 2021-01-14 07:05:21
- OfStack
The default program distribution path for tomcat7 is tomcat/webapps/ROOT/.
example
tomcat/webapps/ROOT/ tomcat/webapps/ROOT/
[http://localhost:8080/index.jsp
]To access.
For another example, when I do the function of uploading and downloading files, I can create a new FileUpload folder under ROOT, set the path of uploading files to this folder, and then upload a file test.txt; When doing the download function, click the download button of this file to directly open 1 URL:
[http://localhost:8080/FileUpload/test.txt
]Modify the
Open the tomcat conf/server xml, have the following code:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
name is the local access address, appBase is the parent address of the project, both can be changed. Add the following tags between the host tags
<Context path="" docBase="example" debug="0" reloadable="true" />
path is the name of the virtual directory, just enter the IP address will display the home page, docBase is the path of the virtual directory, the default is tomcat/webapps/ROOT/, we change to docBase= "example", then example and ROOT function is the same!
mission success
conclusion