tomcat7默認的程序發布路徑為tomcat/webapps/ROOT/下面
修改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" /> </Host>
name為本地訪問地址、appBase為項目的父地址,均可以修改。在host標簽之間加入如下標簽
<Context path="" docBase="example" debug="0" reloadable="true" />
此刻example目錄和ROOT目錄的作用是一樣了