O'Reilly logo

Tomcat: The Definitive Guide, 2nd Edition by Ian F. Darwin, Jason Brittain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Apache Integration with Tomcat

Now that you have Apache set up and running on your system, you're ready to tackle Tomcat integration. Choose the option you like, and walk through that section, or try each option out and see which you like best.

Sharing the Load Using Separate Port Numbers

Each server that is waiting for incoming connections from clients is said to be listening on a particular TCP port number on the machine it is running. These port numbers are like telephone extension numbers within a building. Web servers normally listen on port 80, which is the officially assigned default port number for World Wide Web (WWW) services. Browsers know this so that when you navigate to a URL like http://tomcatbook.darwinsys.com/, the browser will connect to Ian's server on the default port 80. On the other hand, if you put a port number in the URL, such as http://foo.bar.xyz:1234/index.html, the browser will connect to the (hypothetical) server machine on port 1234.

Just as you can't contact two different people concurrently on the same telephone extension, you can't have two web servers listening on the same port number. So, if you want to run two server programs on the same machine, one of them has to "leave town," or move to a different port number—they both can't run on port 80. How you specify that is, of course, server implementation-dependent. In the Apache httpd server, you use a Listen directive in the httpd.conf file. In Tomcat, you specify the port attribute on the HTTP

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required