tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re[2]: mod_jk /examples/* works but /servlet/* doesn't
Date Fri, 21 Jun 2002 16:29:26 GMT
Hello Avnish,

here's the scoop.

For each context you want to map from Apache to Tomcat, do the
following (examples based on the Win32 platform):

First, the common stuff at the top of the mod_jk.conf file (Note that
you would put the following info in the mod_jk.conf which
would be included at the bottom of your httpd.conf):

<IfModule !mod_jk.c>
  LoadModule jk_module modules/mod_jk.dll
</IfModule>

JkWorkersFile "C:/Program Files/Apache Group/Jakarta/tomcat-4.1.3/conf/mod_jk/workers.properties"
JkLogFile "C:/Program Files/Apache Group/Jakarta/tomcat-4.1.3/logs/mod_jk.log"

JkLogLevel emerg


This is for when you want Apache to direct *everything* to tomcat:

JkMount /manager ajp13
JkMount /manager/* ajp13
JkMount /examples ajp13
JkMount /examples/* ajp13
etc...
...
...

Note that you can do:

JkMount /servlet/* ajp13

However, when Tomcat gets this request, it will be serving servlets
out of the ROOT context whereas static files that come in requests
such as /index.html will be served out of Apache's web root.  If your
set up is this way, more power to you.  You can do the following,
though:

JkMount / ajp13
JkMount /* ajp13

That will make Tomcat take over Apache's web root forcing *all*
requests to Tomcat.



This is for when you want Apache to serve static content and only
direct dynamic content to Tomcat:

    #################### localhost:/examples ####################

    # Static files 
    Alias /examples "C:/Progra~1/Apache~1/Jakarta/tomcat-4.1.3/webapps/examples"

    <Directory "C:/Progra~1/Apache~1/Jakarta/tomcat-4.1.3/webapps/examples">
        Options Indexes FollowSymLinks
        DirectoryIndex index.html index.htm index.jsp 
    </Directory>


    # Deny direct access to WEB-INF and META-INF
    #
    <Location "/examples/WEB-INF/*">
        AllowOverride None
        deny from all
    </Location>

    <Location "/examples/META-INF/*">
        AllowOverride None
        deny from all
    </Location>
    #
    # Use Directory too. On Windows, Location doesn't work unless case matches
    #
    <Directory "C:/Progra~1/Apache~1/Jakarta/tomcat-4.1.3/webapps/examples/WEB-INF/">
        AllowOverride None
        deny from all
    </Directory>

    <Directory "C:/Progra~1/Apache~1/Jakarta/tomcat-4.1.3/webapps/examples/META-INF/">
        AllowOverride None
        deny from all
    </Directory>

    JkMount /examples/jsp/security/protected/j_security_check  ajp13
    JkMount /examples/CompressionTest  ajp13
    JkMount /examples/SendMailServlet  ajp13
    JkMount /examples/servletToJsp  ajp13
    JkMount /examples/snoop  ajp13
    JkMount /examples/*.jsp  ajp13
    JkMount /examples/servlet/*  ajp13

Notice that when you don't send everything to Tomcat, you have to be a
bit more careful about what you do.


BTW, you can autogenerate this in Tomcat 4 by putting the following
within any one of you <host> elements in server.xml:

<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
            append="true"
            forwardAll="false"/>


That should be it other than the workers.properties file I am
attaching.

Does this help?

Jake


Friday, June 21, 2002, 10:43:32 AM, you wrote:

AP> Brendan,
AP> Thanks extending your help.
AP> I can go with individual deployment, not a big problem (but still is a
AP> problem isn't it). But just want to know when this isn't supported than why
AP> the hell so many sites (I have seen more than 4-5 sites, one site setup J2EE
AP> on windows and use ONLY these two directives, /*.jsp and /servlet/*)
AP> mentions this thing? Why don't they clearly write it down it doesn't work
AP> this way ? This question is not about you or me, it's about them who claim
AP> this works when in fact it doesn't.
AP> I have verified same behavior on 3 different machine with 100% individual
AP> setups with same results.

AP> Again I would like to ask EVERYONE, HAS ANY BODY SUCCESSFULLY TRIED
AP> FOLLOWING DIRECTIVE ?
AP> "JkMount /servlet/* ajp13"

AP> If yes, PLEASE let me know on which platform. I have spent nearly more than
AP> three days setting it up on three different machines. Am I missing something
AP> ?

AP> Thanks
AP> Avnish.
AP> ----- Original Message -----
AP> From: <Brendan.Richards@lowelive.com>
AP> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
AP> Sent: Friday, June 21, 2002 8:37 PM
AP> Subject: Re: mod_jk /examples/* works but /servlet/* doesn't




AP> Hi Avnish,

AP> To be honest, I've always just set a line in the httpd.conf for each webapp
AP> / context deployed.....
AP> All the documentation/examples i've seen show a JKMount being used for each
AP> context.

AP> I generally don't need more than one or two webapps on each server so it's
AP> not usually a problem for me.

AP> Plus I only bother setting up the Apache mod_jk config when I put a web
AP> application live - during servlet development and debugging I like to keep
AP> the setup as simple as possible.


AP> Good Luck....

AP> Brendan.

AP> ps. remember to Alias your $CATALINA_HOME/webapps/appname directory in
AP> httpd.conf to get Apache to serve the static content in your webapp



AP> ---------------------------------------------


AP> Hi Brendan,
AP> with JkMount /*/servlet/* ajp13, debug files shows following lines. And
AP> maps
AP> root (/) to tomcat which is not what I want :(
AP> [jk_uri_worker_map.c (256)]: Into jk_uri_worker_map_t::uri_worker_map_open,
AP> suffix rule /.jsp=ajp13 was added
AP> [jk_uri_worker_map.c (267)]: Into jk_uri_worker_map_t::uri_worker_map_open,
AP> match rule /=ajp13 was added

AP> Tried others combinations too but it seems * is totally ignored. for
AP> example
AP> with directive JkMount /servlet/** ajp13
AP> [jk_uri_worker_map.c (256)]: Into jk_uri_worker_map_t::uri_worker_map_open,
AP> suffix rule /.jsp=ajp13 was added
AP> [jk_uri_worker_map.c (267)]: Into jk_uri_worker_map_t::uri_worker_map_open,
AP> match rule /servlet/=ajp13 was added



AP> Hi John,
AP> I have my tomcat properly configured(Everything default config). I m able
AP> to
AP> get all contents with localhost:8080 successfully and even with directive
AP> /examples/servlet/*.
>>>From log file I came to know localhost/examples/servlet/<anything> is not
AP> being forwarded to tomcat at all.

AP> I would like to know if any one has ever configured tomcat with apache
AP> using
AP> "JkMount /servlet/* ajp13" and if yes, on which platform?

AP> Thanks
AP> Avnish
AP> ----- Original Message -----
AP> From: <Brendan.Richards@lowelive.com>
AP> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
AP> Sent: Friday, June 21, 2002 7:50 PM
AP> Subject: Re: mod_jk /examples/* works but /servlet/* doesn't




AP> Or perhaps it would be even better to try:

AP> JkMount /*/servlet/* ajp13

AP> or:
AP> JkMount **/servlet/* ajp13

AP> Brendan

AP> --------------------------------------------

AP> I don't know if this will work or not...

AP> but have you tried:

AP> JkMount /servlet/** ajp13

AP> If it works, let me know...

AP> Brendan

AP> --------------------------------------------

AP> Hi Everyone,
AP> Recently I have connected apache with tomcat using mod_jk. In my httpd.conf
AP> file I am giving this directive.
AP> JkMount /examples/* ajp13

AP> It works perfectly fine but problem is it forwards all requests to apache.
AP> I
AP> want static requests to be handled by Apache.
AP> As per documentation only these two directives should be sufficient
AP> JkMount /*.jsp ajp13
AP> JkMount /servlet/* ajp13

AP> But with above config I am not able to get my servlets working. From mod_jk
AP> logs (after changing log level to debug) I came to know these requests are
AP> not being forwarded to tomcat and apache try to handle these requests
AP> itself
AP> :(
AP> I tried with this directive instead
AP> JkMount /examples/servlet/* ajp13

AP> And it's working perfectly. But with this everytime I add new context, I
AP> have to add new directive for this context's servlet :(.  I don't want
AP> that.
AP> Document says "JkMount /servlet/* ajp13"  should work but isn't working !!
AP> Any idea why.
AP> I have tried all combinations */servlet/*, *servlet/* but no use.
AP> I am using apache 1.3.24, Tomcat 4.0.2, JDK 1.3, Windows 2000

AP> Any help would be greatly appreciated.

AP> Thanks
AP> Avnish


AP> --
AP> To unsubscribe, e-mail:
AP> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
AP> For additional commands, e-mail:
AP> <mailto:tomcat-user-help@jakarta.apache.org>




AP> --
AP> To unsubscribe, e-mail:
AP> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
AP> For additional commands, e-mail:
AP> <mailto:tomcat-user-help@jakarta.apache.org>




AP> --
AP> To unsubscribe, e-mail:
AP> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
AP> For additional commands, e-mail:
AP> <mailto:tomcat-user-help@jakarta.apache.org>




AP> --
AP> To unsubscribe, e-mail:
AP> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
AP> For additional commands, e-mail:
AP> <mailto:tomcat-user-help@jakarta.apache.org>




AP> --
AP> To unsubscribe, e-mail:
AP> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
AP> For additional commands, e-mail:
AP> <mailto:tomcat-user-help@jakarta.apache.org>




AP> --
AP> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
AP> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com
Mime
View raw message