1.设置tomcat的server.xml
<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 path="/file" docBase="D:Filefile"></Context> <Context path="/image" docBase="D:Fileimage"></Context> </Host>
增加<Context>的配置
2.但是有可能并不起作用,使用idea启动tomcat并不工作
还需要设置
运行服务器: