Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running Apache2.2 and Tomcat7.0 on Windows.

How do I setup JkMount to allow access to any deployed webapp on Tomcat in the form domain.com/tomcat/nameOfWebapp?

Here is my workers.properties:

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

Here is the relevant part of my httpd.conf:

LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>

    JkWorkersFile D:/servers/tomcat7.0/conf/workers.properties
    JkLogFile D:/servers/tomcat7.0/logs/mod_jk.log
    JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
    JkRequestLogFormat "%w %V %T"
    JkLogLevel info
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

    Alias /tomcat "D:/servers/tomcat7.0/webapps/"

    <Directory "D:/servers/tomcat7.0/webapps/">
        AllowOverride None
        Allow from all
    </Directory>

    <Location /*/WEB-INF/*>
        deny from all
    </Location>

    JkMount /tomcat/* worker1
</IfModule>

If I just do something like JkMount /manager* worker1 I can get the manager webapp to work, but how can I get it to load any app that is deployed to Tomcat?

What I have now gives me this error:

The requested resource (/tomcat/manager/) is not available.

when trying to visit domain.com/tomcat/manager. The error is given by Tomcat so it's getting to it but for some reason it doesn't want to load it.

Thanks

share|improve this question

2 Answers 2

up vote 0 down vote accepted

If you want everything to be available under, say, /tomcat/[webappname], then you can do it like this:

JkMount /tomcat/* worker1

Then, re-name all your web applications' WAR files to use nested-paths that all fall under /tomcat, like this:

CATALINA_BASE/webapps$ mv ROOT.war tomcat.war
CATALINA_BASE/webapps$ mv app1.war tomcat#app1.war
CATALINA_BASE/webapps$ mv app2.war tomcat#app3.war
CATALINA_BASE/webapps$ mv app3.war tomcat#app3.war

The effect will be that now, all webapps will have /tomcat/app1 (or whatever) as their context path. If you're written them correctly, this relocation should not be a problem at all, and you can allow httpd to continue to serve requests (even to .jsp if you want) to paths outside of /tomcat/.

share|improve this answer
    
That seemed to work, though I didn't have the wars, I just named the foloders with the hashtag. Why does the hashtag cause this behavior? I haven't seen that in the documentation related to JkMount but I may have missed it. –  Talon876 May 25 '12 at 4:13
    
@Talon876 That's not a mod_jk thing, it's a Tomcat thing: tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming –  Christopher Schultz May 25 '12 at 14:02

Looks like I wanted to have this in my httpd.conf:

JkMount /*.jsp worker1
JkMount /*/tomcat/ worker1
share|improve this answer
    
Hmm, looks like that just gets me permission errors. –  Talon876 May 23 '12 at 1:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.