Chapter 5. Integration with Apache Web Server

Introduction

Suppose you already have your main web site up and running with Apache httpd web server. You want to get started with Tomcat, but not switch your entire site over. Or you want to use Tomcat for servlets and JavaServer Pages, but keep running the older server because you believe it will give better performance for static pages, binary images, and the like. There are several ways of integrating Tomcat into another web server, but they fall into several general categories, which are listed here in increasing order of quality and complexity:

  • Two port numbers connected by URLs

  • Proxying requests from Apache httpd to Tomcat

  • Connector modules

  • In-process or “full integration”

The first approach, using two port numbers connected by URLs, is the simplest to implement. You simply put URLs in your existing web page directory that link to Tomcat’s web server port (say, 8080) on the same web server machine. You are running two full web server programs, with no real integration between them.

The second approach uses the HTTP proxy mechanism in the main server. Proxies are often used to reroute web traffic from a web server running on a gateway machine to sites on the outside Internet. However, they can also be used to redirect traffic for one directory or section of your web site to a Tomcat web application.

The third way is to use a connector module (such as mod_jk) that runs inside the existing Apache httpd web server and quickly transfers the ...

Get Tomcat: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.