Image via Wikipedia
There are three standard port types for a single tomcat configuration:
You can find all of these configurations at CATALINA_BASE/conf/server.xml
out of box port config is like this:
<Server port="8005" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/> <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> </Service> </Server>
you control these ports by passing JVM argument and reusing the parameter at server.xml
<Server port="${tomcat.init.port}1" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="${tomcat.init.port}2" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="${tomcat.init.port}3"/>
<Connector port="${tomcat.init.port}3" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"/>
<Connector port="${tomcat.init.port}4" protocol="AJP/1.3" redirectPort="${tomcat.init.port}3"/>
</Service>
</Server>
CATALINA_OPTS=-Dtomcat.init.port=908
./startup.sh
so you will have
SHUTDOWN:9081
HTTP:9082
HTTPS:9083
AJP:9084
you can also use to run multiple tomcat with same configuration file
Related posts: