Here is what I did to connect both. Note that I use Tomcat4.0.3 together
with OpenSA Web Server (Apache 1.3.26 with built-in SSL support):
Connecting Tomcat and Apache
In this section you will learn
* some bla bla about connecting Tomcat and Apache
Each of those servers will be used according to its specific tasks:
Apache will be used as web server and Tomcat as application server.
The connection between them must be established in order to serve
dynamic content via port 80 (the default port for web servers). If you
connect both, *.jsp-files as well as servlets will be passed on to
Tomcat and handled by it. Apache is therefore only the arbitrator. Of
course all static content will be sent through Apache to the
clients.Basically there are two possibilities to connect Apache and
Tomcat on a Windoze-based OS:
* mod_webapp
* mod_jk
Though it is not recommended to get the mod_webapp as connection
handler, I did it - with the expected results: it is buggy and crashes
the servers just after startup. So I had to switch to mod_jk and propose
that you do this also. If you expect heavy load on your server you
should use mod_jk as mod_webapp has no load balancing capabilities.
Obtaining necessary components
In this section you will learn
* how to obtain mod_jk
You get the binary version of mod_jk by pointing your browser to the
following URL:
*
http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.4/bin/win32/i386/
(Apache up to version 1.3)
* http://www.acg-gmbh.de/mod_jk/ (Apache from 2.0 and higher)
Editing of necessary files
In this section you will learn
* to edit some important config files like
o Apache
+ httpd.conf
o Tomcat
+ server.xml
+ workers.properties
If you are now going to edit important config files for both servers be
sure that your configuration so far is working properly. If you are not
able to start and stop both servers and the examples are not displayed
properly do not continue here. Try first to fix the problems in case
there are any.
If there are no problems with the configuration so far - just go ahead.
First we have to edit server.xml
* browse to the directory where you installed Tomcat
* change to folder conf
* open server.xml in your favourite texteditor
* scroll to the line where <Server port="8005" ...> is stated and
add the following line:
o <Listener
className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk=
"D:\Programme\Server\Apache\modules" />
* then go on to the line where <Service name="Tomcat-Standalone">
is written and add:
o <!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector
className="org.apache.ajp.tomcat4.Ajp13Connector" port="8009"
minProcessors="5" maxProcessors="75" acceptCount="10" debug="0"/>
Now save the modified server.xml and
* browse to your /bin directory of your Tomcat installation directory
* create a new directory called jk in the your /bin directory
* create a new text file and save it as workers.properties, then
* copy the following code and paste it into your workers.properties
file
o # Setup for Windows system
#
workers.catalina_home="D:\Programme\Server\jakarta-tomcat-4.0.3"
workers.java_home="D:\Programme\Java\j2sdk1.4.0_01"
# Linux uses fwd slashes
#ps=/
# Windows uses back slashes
ps=\
worker.list= ajp13
# Definition for Ajp13 worker
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
* modify the path given in there and save the document.
After having done that you should edit httpd.conf. Therefore browse to
your Apache installation directory and add the following to your httpd.conf:
after LoadModules Section:
#--------------------------------------------------------------------#
<IfModule !mod_jk.c>
LoadModule jk_module modules/mod_jk.dll
</IfModule>
#--------------------------------------------------------------------#
and additionally at the end of your httpd.conf file:
#-------------------------------Load
mod_jk-----------------------------------------#
<IfModule !mod_jk.c>
LoadModule jk_module
"D:/Programme/Server/OpenSA/Apache/modules/mod_jk.dll"
</IfModule>
JkWorkersFile
"D:/Programme/Server/jakarta-tomcat-4.0.3/conf/jk/workers.properties"
JkLogFile
"D:/Programme/Server/jakarta-tomcat-4.0.3/logs/jk_log.txt"
JkLogLevel debug
JKMount /servlet/* ajp13
JkMount /*.jsp ajp13
JkMount /examples/* ajp13
JkMount /manager/* ajp13
JkMount /tomcat-docs/* ajp13
JkMount /webdav/* ajp13
JkMount /login/* ajp13
#-----------------------------------------------------------------------------------#
Do not forget to copy mod_jk.dll into the module folder of your Apache
Web Server. Having done so, configuration is over and you are ready to
run Tomcat through Apache. Apache then is serving the static content,
the dynamic content is handled by Tomcat.
Heligon Sandra wrote:
> Before posting the message I read the http://www.acg-gmbh.de/mod_jk/
> but I thought that the mod_jk.dll was not good in relation to the notes.
> It was an error from me.
> But It doesn't work. I can start Apache an Tomcat but I can not
> run my web applications. When I start Tomcat no web application
> is deployed.
>
> I have a question why the AddModule expression is not added
> to the httpdconf ? is this expression present in the mod_jk.conf-auto ?
>
> The link http://www.cnr.berkeley.edu/~salazar/apache_tomcat.html is very
> interesting, but the notion of <Host name="localhost" debug="0"
> appbase="webapps">
> is noted and I don't have any such element in the server.xml file.
> I think that that the <Listener
> className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" /> is
> optional, isn't it ? If the web applications are automatically
> deployed we don't have context elements in the server.xml.
> What is the best solution ?
> I added only the <Listener
> className="org.apache.ajp.tomcat4.config.ApacheConfig">
> element but I don't know if I must add a closed tag </Listener> and where ?
> With this line I can not start Tomcat and the log gives no help.
>
> Can somebody send me a server.xml file that allow to enable apache auto
> configuration ?
> Thanks a lot.
>
>
> -----Original Message-----
> From: Turner, John [mailto:[EMAIL PROTECTED]]
> Sent: 31 July 2002 15:06
> To: 'Tomcat Users List'
> Subject: RE: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or
> mod_webapp ?)
>
>
>
> My advice is to use mod_jk. Mod_jk2 is still new, and there are some issues
> with mod_webapp that prevent it from being ready for production in my
> opinion.
>
> These may help:
> http://www.acg-gmbh.de/mod_jk/ (you need the mod_jk.dll file from here)
> http://www.cnr.berkeley.edu/~salazar/apache_tomcat.html
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/ajp.html
>
> John Turner
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: Heligon Sandra [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 31, 2002 8:54 AM
> To: '[EMAIL PROTECTED]'
> Subject: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or mod_webapp ?)
>
>
>
> Hi,
>
> I am working on a web application.
> I used the default Tomcat4.0.4 configuration until now.
> (standalone mode execution).
> I would like to use Apache and Tomcat together but I don't
> understand what I must do.
> The configuration is very hard, there are a lot of elements
> httpd.conf, server.xml, mod_jk.dll or mod_jk2.dll or
> mod_webapp.dll...
> I don't know what module I must use ?
>
> My environment is the following:
> - Windows 2000
> - Tomcat4.0.4 (I believe that the new version 4.1 is better with JSP
> but it implies
> new configuration yet)
> - Apache2.0.39 (it's the last stable version, I believe)
>
> I don't know the new features of mod_jk2 vs mod_jk vs mod_webapp.
> Do I have to create a <context> element for each web application
> with mod_jk
> or can each application deploy automatically ?
>
> If I want to use mod_jk2, how can I get the mod_jk.dll associated to
> Tomcat4.0.4
> and Apache2.0.39 ?
>
> I read that it is possible to enable Apache -Tomcat automatically
> with include
> the file mod_jk.conf-auto in the httpd.conf.
> How is the mod_jk.conf-auto file generated ?
>
> Thanks a lot in advance.
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>