linux下同一个tomcat部署多个项目
linux下同一个tomcat部署多个项目
第二个项目访问方式: project_demo2.com:8080
<!-- 一个端口多个域名 --> <Service name="Catalina"> <!--这里默认使用8080端口--> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <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" appBase="project_path_01 这里写你项目的路径" unpackWARs="true" autoDeploy="true"> <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="/" docBase="perfect-demo01.war 这里写你的war包名字" debug="0" privileged="true" reloadable="true"/> </Host> <!--第二个项目--> <Host name="project_demo2.com" appBase="project_path_02 这里写你项目的路径" unpackWARs="true" autoDeploy="true"> <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="/" docBase="perfect-demo02.war 这里写你的war包名字" debug="0" privileged="true" reloadable="true"/> </Host> </Engine> </Service>
第三个项目访问方式: project_demo3.com:8081
<!--新的端口新域名--> <Service name="Catalina"> <!--注意这里的端口使用8081--> <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="myspring.com"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="project_demo3.com" appBase="project_path_03 这里写你项目的路径" unpackWARs="true" autoDeploy="true"> <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="/" docBase="perfect-demo03.war 这里写你的war包名字" debug="0" privileged="true" reloadable="true"/> </Host> </Engine> </Service>