In the development process, we often encounter the picture/audio Video storage problem, this time we need to configure the server to store static resources of the virtual path
Step one: Open the Server.xml configuration file, which is in the tomcat/conf directory
Step two: The following figure embeds a context label under the host tag in the Server.xml file, path is the mapped web path, and Dobase is the physical path to the local disk. Context element Properties Introduction: Click to open the link
<context path= "/TG" docbase= "e:\ data" debug= "0" reloadable= "true"/>
Step three: How to access.
As described in step two picture, my static resource file is an img file under E disk, assuming I placed a tg.png picture in the img file, as shown above, you can access it via http://127.0.0.1:8080/tg/tg.png.
----------------------------------------------------------------------------------
Set Tomcat to allow access to static folder modify Web.xml file The following picture position to modify false to True
Web Access Map