tomcat-multiport publishing project

    A tomcate can publish projects on different ports at the same time, and one port can publish multiple projects at the same time. Here is an example of server.xml configuration (it seems that Chinese comments cannot be added)

<?xml version='1.0' encoding='utf-8'?>

<Server port="8005" shutdown="SHUTDOWN">
	<!--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>
		<!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -->
		<Resource name="UserDatabase" auth="Container"
		type="org.apache.catalina.UserDatabase"
		description="User database that can be updated and saved"
		factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
		pathname="conf/tomcat-users.xml" />
	</GlobalNamingResources>

	<!--Publish the first port, multiple projects can be published in this port-->
	<Service name="Catalina">
		<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.UserDatabaseRealm" resourceName="UserDatabase"/>
			<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
				<!--Add item to port 8080-->
				<Context path="" docBase="/home/sxdkj/project/support" reloadable="true" crossContext="true"/>
				<Context path="/game-stat" docBase="/home/sxdkj/project/game-stat" reloadable="true" crossContext="true"/>
				<Context path="/gm" docBase="/home/sxdkj/project/gm" reloadable="true" crossContext="true"/>
				<Context path="/gm-xh" docBase="/home/sxdkj/project/gm-xh" reloadable="true" crossContext="true"/>
				<!--Print logs to the logs directory-->
				<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
			</Host>
		</Engine>
	</Service>

	<!--Publish the second port, this port can publish multiple projects-->
	<Service name="Catalina2">
		<Connector port="9001" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
		<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
		<Engine name="Catalina2" defaultHost="localhost">
			<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
			<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">	
				<!--Add item to port 9001-->
				<Context path="" docBase="/home/sxdkj/project/tencent-order" reloadable="true" crossContext="true"/>
				<!--Print logs to the logs directory-->
				<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
			</Host>
		</Engine>
	</Service>
</Server>

 

2. A service plug-in that is easier to use under eclipse - tomcatplugin

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326947710&siteId=291194637