tomcat port configuration

Apache Tomcat

Image via Wikipedia

There are three standard port types for a single tomcat configuration:

  • HTTP: (default:8080) your http connector
  • AJP :( default: 8009)  tomcat ajp connection port
  • SHUTDOWN (default:8109 ): tomcat shutdown command listener port
  • HTTPS (default: 8443/optional): tomcat https port listener

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

Reblog this post [with Zemanta]
Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Wists
  • LinkedIn
  • Slashdot
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • email
  • Twitter
  • FriendFeed

Related posts:

  1. multiple tomcat instance – single setup
  2. URI Encoding for tomcat 5.5.X
  3. Complete Apache 2.2-AJP Load Balance via mod_proxy
  4. Moving from Tomcat to JBoss
  5. JGroups Basics

  1. No comments yet.

  1. No trackbacks yet.