1.编辑tomcat中的server.xml文件
2.在Host标签下添加:
说明:
docBase 对应linux 服务器真实路径
path 对应tomcat 访问路径
<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" /> <Context docBase="/root/image/" path="/caiji" debug="0" reloadable="true"/> </Host>
访问:http://ip/caiji/图片名字.png