tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Custom web application as default web app
Date Mon, 04 Aug 2008 12:44:45 GMT
sasuke wrote:
> Hello all.
> I have recently started developing J2EE applications using Tomcat and have
> come across a stumbling block. Suppose I want to run Tomcat in an
> environment close to what it would be in production; to do I need to do the
> following:
  • Make sure Tomcat is running on port 80 so that there is no need to 
> the port number.
> • Make sure that hitting brings up my custom application
> and not the tomcat manager.
> • Make sure that a light web server like lighttpd or Apache is used for
> serving static content and redirecting to tomcat when dynamic jsp
> compilation is required.
> • Make sure that the sessions are persisted when the above arrangement is
> put in clustered mode.

I can't answer all your questions competently, but here is a start :

a) your requirements 1 and 3 above seem to be contradictory.
The usual way to do this is to have the "light" httpd server in front, 
answering all requests to port 80.
Then, inside that front-end httpd server, there is a mechanism for 
detecting which requests should go to a *background* Tomcat, and 
re-direct these requests, in a way transparent to the client.
For example, using Apache and Tomcat, you would use the following setup :
- Apache answering on port 80
- a "re-director" module within Apache (like mod_jk), gets told which 
URLs have to go to Tomcat, and intercepts those URLs.
The other URLs are served by the local httpd server.
- in Tomcat, a corresponding "connector" receives these requests, and 
Tomcat processes them, and sends the response back through the connector.
- Apache receives the response from the mod_jk re-director, and sends 
them to the client.

But, there are many people on this list that will tell you that if the 
purpose is simply to serve some static pages, you do not need a 
front-end http server, and you can do it all with Tomcat alone.

On the other hand, I believe that your requirement #4 means that you 
must have a front-end server.

b) to have Tomcat respond to port 80 (assuming there is no other httpd 
server that already does), is simple : just change the port number of 
the HTTP connector in Tomcat's "server.xml" file.  By default it is set 
to 8080 or 8180, it's easy to find.
But decide first which architecture you want, because you cannot have 2 
http servers (Tomcat and another one) both listening on the same port.

For 2 you need more expert help than I can provide.
But I believe it consists of deleting what is now the ROOT application 
of Tomcat, and put yours in it's place.
Wait for more expert advice, or look at previous messages on this list. 
This has been explained many times before.


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message