The default port for Tomcat (and other "secondary" web servers/servlet containers) is 8080.
If there are multiple services configured for this port or there is a need to install multiple instances of Tomcat on a server then you can can edit this port value in ${CATALINA_HOME}/conf/server.xml.
Is there a standard for determining what port number(s) that other installations should use? Is there a standard +1/+10/+100/+1000 approach that is typically followed? Is there a way to determine if there is conflicts without picking something and just trying it?
Also, in server.xml, there is by default:
<Server port="8005" shutdown="SHUTDOWN">
<Connector port="8080" protocol="HTTP/1.1" redirectPort="8443" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
For additional Tomcat installations, do all of these need to be renumbered/included? Should they each follow the same renumbering strategy?
By default the tomcat binding ports are 8005, 8080 and 8009. If you have another tomcat instance running on same server or other application like JBoss Application Server, these ports are likely already used.
With the default configuration, Apache Tomcat will listen for requests on port 8080. To use a different port, edit the server.
Is there a way to determine if there is conflicts without picking something and just trying it?
The latest version of Tomcat 7.0.25 includes functionality to automatically find and bind to a free port. This isn't great for any kind of production installation but is pretty neat for testing and development purposes.
To answer your original question, I quite like 9090 when 8080 is taken but I'm not aware of any specific best practice in this area.
The Tomcat docs which describe auto port binding are here.
And yes, all the other ports will need to be changed as well.
If you bind multiple tomcats on the same IP address, you will need to use different ports on the connectors, and set them manually in the server.xml file.
I always used +1 by personnal convention.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With