Connectors and Ports (server.xml)

Harry · 12 Sep 2026 · 11 views

What a Connector Does

A connector accepts TCP connections and produces HTTP requests for the engine. This is where ports, timeouts, thread pools and protocols are configured in conf/server.xml.

The Default HTTP Connector

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000" maxThreads="200" />

Common Attributes

  • port - the TCP port (8080 default; 80 needs root on Unix).
  • protocol - HTTP/1.1 (NIO) or HTTP/2 via AJP/HTTP upgrades.
  • maxThreads - maximum request worker threads.
  • minSpareThreads - threads kept ready under load.
  • connectionTimeout - ms before an idle connection is dropped.
  • maxHttpHeaderSize - raise if large headers or tokens fail.
  • uriEncoding - set UTF-8 for correct non-ASCII URLs.

Tips

  • Never put Tomcat directly on the internet - proxy through nginx with TLS (port 80/443) and keep Tomcat on 8080 internally.
  • If you must bind 80/443, use the authbind package or run via systemd with CapabilityBoundingSet=CAP_NET_BIND_SERVICE.
  • To accept query params and paths with UTF-8 correctly, add URIEncoding="UTF-8" to each connector.

Key Points

  • Connectors = the front door; tune threads and timeouts to your traffic.
  • Use a reverse proxy for TLS and public exposure.
  • Restart Tomcat after changing server.xml.
Share this post:

Comments (0)

Please login or register to comment.