原创

一个tomcat部署两个项目

1.首先下载tomcat,解压到D盘;
2.进入目录,复制wabapp
如图所示:

file
3.打开conf目录下的server.xml, 复制 修改,如下图所示

<?xml version="1.0" encoding="UTF-8"?>

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->

<!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html -->

-<Server shutdown="SHUTDOWN" port="8005">

<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>

<!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> -->


<!--APR library loader. Documentation at /docs/apr.html -->


<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>

<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->


<Listener className="org.apache.catalina.core.JasperListener"/>

<!-- Prevent memory leaks due to use of particular java/javax APIs -->


<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>

<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>


-<GlobalNamingResources>

<Resource type="org.apache.catalina.UserDatabase" pathname="conf/tomcat-users.xml" name="UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" description="User database that can be updated and saved" auth="Container"/>

</GlobalNamingResources>


-<Service name="Catalina">

<Connector port="8081" useURIValidationHack="false" useBodyEncodingForURI="true" redirectPort="8443" protocol="HTTP/1.1" minSpareThreads="25" minProcessors="5" maxThreads="500" maxSpareThreads="100" maxProcessors="300" maxPostSize="-1" enableLookups="false" disableUploadTimeout="true" connectionTimeout="30000" compressionMinSize="2048" compression="on" compressableMimeType="text/html,text/xml,text/JavaScript,text/css,text/plain" acceptCount="100" URIEncoding="UTF-8"/>

<Connector port="8009" redirectPort="8443" protocol="AJP/1.3"/>


-<Engine name="Catalina" defaultHost="localhost">


-<Realm className="org.apache.catalina.realm.LockOutRealm">

<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

</Realm>


-<Host name="localhost" unpackWARs="true" autoDeploy="true" appBase="webapps">

<Valve className="org.apache.catalina.valves.AccessLogValve" suffix=".txt" prefix="localhost_access_log." pattern="%h %l %u %t "%r" %s %b" directory="logs"/>

<Context source="org.eclipse.jst.jee.server:OBD_VECSP" reloadable="true" path="/OBD_VECSP" docBase="OBD_VECSP"/>

</Host>

</Engine>

</Service>


-<Service name="Catalina">

<Connector port="80" useBodyEncodingForURI="false" redirectPort="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" enableLookups="false" connectionTimeout="20000" URIEncoding="UTF-8" maxHttpHeaderSize="4096"/>


-<Engine name="Catalina1" defaultHost="obd-test.cn">


-<Realm className="org.apache.catalina.realm.LockOutRealm">

<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

</Realm>


-<Host name="obd-test.cn" unpackWARs="true" autoDeploy="true" appBase="webapps1">

<Context reloadable="true" path="" docBase="ROOT"/>

<Valve className="org.apache.catalina.valves.AccessLogValve" suffix=".txt" prefix="localhost_access_log." pattern="%h %l %u %t "%r" %s %b" directory="logs"/>

</Host>

</Engine>

</Service>

</Server>

4.复制两个Catalina文件夹,如图所示:
file
5,OK这样就搞定了,可以在两个wabapp下部署不同的项目了
如有疑问可以留言!!!!

正文到此结束
本文目录