tomcat一个端口配置多个项目
在server.xml中增加host节点
<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> <Host name="sin2x.com" appBase="/data/www/apps/sin2x" <!--C盘host文件需要添加解析到 'sin2x.com' ---> unpackWARs="true" autoDeploy="true"> <Context path="" docBase="ROOT" reloadable="true"/> <!--docBase可以写绝对路径,即已‘/’开头,不写绝对路径则从appBase路径开始算---> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="sin2x.com_access_log" suffix=".txt" <!--指定日志--> pattern="%h %l %u %t "%r" %s %b" /> </Host>