If you use mod_jk, you should only tamper with server.xml and workers.properties.

Use mod_jk.conf-auto as a template for mod_jk's apache configuration flags.

Example:

Let's suppose you have the following entry in /etc/hosts:
192.168.0.2  MyServer

Let's suppose you have the following entries in apache's httpd.conf:

NameVirtualHost 192.168.0.2
Include /usr/local/opt/apache/conf/mod_jk.conf
Include conf/projects/MyProject

Let's suppose you have the following entries in conf/projects/MyProject:
<VirtualHost MyServer:80>
        DocumentRoot /var/www/MyServer
        ServerName MyServer
        ServerAdmin webmaster@MyServer

        ErrorLog /var/log/httpd/MyServer-error_log
        TransferLog /var/log/httpd/MyServer-access_log

        <Directory /var/www/MyServer/>
                Options Indexes
        </Directory>

        JkMount /*.jsp ajp13
        JkMount /cgi-bin/* ajp13
</VirtualHost>

Let's suppose you have the following entries in conf/mod_jk.conf:
LoadModule jk_module libexec/mod_jk.so
JkWorkersFile /usr/local/opt/tomcat/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk
JkLogLevel debug

Let's assume you have a pristine workers.properties.

Let's suppose you have the following in /usr/local/opt/tomcat/conf/server.xml:
(besides commenting unneeded services)

Add (just after the Ajp12 Connector Tag):
        <!-- Apache AJP13 support.
          -->
        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
            <Parameter name="handler"
       value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
            <Parameter name="port" value="8009"/>
        </Connector>

and on the hosts section (in the end):
        <Host name="MyServer" >
                <Context path="/"
                    docBase="/var/servlets/MyServer/"
                    debug="1"
                />
        </Host>


Let's suppose that in /var/servlets/MyServer/ you have a WEB-INF dir with your project.

With this kind of setup, when you reach http://MyServer, you reach the contents in 
/var/www/MyServer.
As soon as you enter an url as http://MyServer/cgi-bin/MyServlet or 
http://MyServer/something/MyJsp.jsp, this requests will be forwarded to tomcat as 
MyServer/cgi-bin/MyServlet and MyServer/something/MyJsp.jsp.

/cgi-bin/MyServlet must be a servlet's url-pattern defined in web.xml (of your 
project) for your servlet, and on /var/servlets/MyServer/ must exist 
something/MyJsp.jsp

This is an overview of how to configure a host.

I hope it helps. It's probably not foolproof, but I'll let your wits and the help of 
other for deeper details of configuration. This is my contribution :)

Hugs and good luck, rms


On Tue, Apr 17, 2001 at 07:38:29PM +0100, Raj Subramani wrote:
> Hi,
> 
> I have been trying to get mod_jk to integrate with my Apache/Tomcat 
> environment.
> 
> The documentation talks endlessly about jserv and how to use it even 
> though right at the top there is a line saying if you use "mod_jk" 
> disable "jserv".
> 
> Fantastic.
> 
> Finally I reached this archive list to find that I was not alone. Thank 
> god for that else I would have jumped off this floor that I am on.
> 
> Since Apache cannot seem to resolve /example/servlet to /example 
> (apparently that directive is in toncat-apache.conf which iis NOT TO BE 
> USED if using mod_jk), what is the solution?
> 
> Any takers?
> 
> Cheers
> -raj

-- 
+ No matter how much you do, you never do enough -- unknown
+ Whatever you do will be insignificant,
| but it is very important that you do it -- Ghandi
+ So let's do it...?

PGP signature

Reply via email to