Can multiple servers wait on the same port?

Here is a discussion on sof

1. Either You have to have a master process that waits on a given port and then using a number of configurable criteria redirects packets to target processes much like a proxy server except that the target apps don't need to have ports at all.

2. Or have a proxy server that redirects requests to target servers that they themselves on other ports but exposes the main proxy port to the general public.

Both IIS and Apache can act as proxy servers for tomcat

Here is tomcat docs on how to configure apache as a proxy server

Here are virtual hosting docs on tomcat

If virtual hosting works for your need, this is the page for the docs of virtual hosting.


<Service....>
    <Connector port="80" address="your-ip" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
               
    <Engine name="Catalina" defaultHost="your-ip">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="your-ip"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

            <Alias>knowledgefolders.com</Alias>
          	<Alias>www.knowledgefolders.net</Alias>
    		<Alias>site2</Alias>
    		....
    		<Alias>siten</Alias>

            <Context path="" docBase="d:/somepath/akc" debug="0"/>
            <Context path="/akc" docBase="d:/somepath/akc" debug="0"/>
      </Host>
      
      <!--Host names and alias names likely need to be different -->
      <host name="new-domain-host1" ...>
          <alias...../>
          <alias .....>
      </host>

      <!--Host names and alias names likely need to be different -->
      <host name="new-domain-host2" ...>
          <alias...../>
          <alias .....>
      </host>
   </Engine>
  </Service>