For
Tomcat you pretty much just need to have two different server.xml files and start each server with the correct one. The easiest way is to have two different installations though that can be difficult to maintain. Once you have something set up look in $TOMCAT_HOME/conf/server.xml and look for the
word "port". There are usually 3 ports - the "shutdown" port (by default on 8005), the HTTP/1.1 connector port (defaults to 8080 with fall over to HTTPS on 8443) and the JK connector port which defaults to 8009. There can be more or less depending on your configuration but these are the default. All of these will need to be changed in a separate installation.