Find the answer to your Linux question:
Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Unhappy Apache / Tomcat / Mod_jk Help !


    I have a FC5 box, running apache 2 and tomcat.

    I have a webapp located at /usr/local/tomcat/webapps/app

    using the URL the jsp and servlets all work fine.

    I have a domain name pointed at the server

    its in apache httpd.conf and works ok.

    But, to view the app, i have to use

    What i want is to be able to go to and see the app

    If i go to i get the tomcat test start page

    This is driving me crazy !!


    <VirtualHost x.x.x.x>
    DocumentRoot /usr/local/tomcat/webapps/app/
    DirectoryIndex index.jsp
    JKMount /* default

    Please, any help would be great

    thanks you

  2. #2
    Bumping this old thread because I have exactly the same question. I'm trying to map subdomains to webapps deployed in Tomcat, e.g. --> -->

    I've configured mod_jk in Apache and I'm able to map URLs under the subdomain to Tomcat, but I have not found a way to map URLs under one subdomain to one Tomcat context, URLs under another subdomain to another Tomcat context. Is this possible?

    Many thanks

  3. #3

  4. $spacer_open
  5. #4
    Thanks, but an HTTP redirect isn't what I'm looking for. I want to map requests internally from Apache to Tomcat.

  6. #5
    This can be done via one of the many Apache redirect options (client or server side) and it can be done with a combination of DNS entries and iptables/redirection (those two I know will work.)

    As for mod_jk, all of the options needed appear to be listed in the Tomcat mod-jk HowTo.

  7. #6
    Thanks for the suggestions, though I don't know what you had in mind re: "DNS entries and iptables/redirection". DNS records for all subdomains are of course pointing at the same server. There are only two ports in question: 80 for Apache (open) and 8080 for Tomcat (not open). I never found a straightforward way to get mod_jk to do what I need (hiding the context of each webapp in Tomcat), although apparently it can be done. In the end, mod_proxy provided a simple (if not the best in terms of performance) solution:

    NameVirtualHost *:80
    <VirtualHost *:80>
        <Location />
    <VirtualHost *:80>

  8. #7
    You can also create two hosts on Tomcat side localhost:8080 (for app1)
    and app2:8080 (for app2). Rename your applications to ROOT.war and do not include context element explicitly.

    Now you can point mod_jk directly to root of those hosts and it work fine.

    The only problem that I have with this setup is that I still need localhost:8080/app1 as local endpoint

    maybe I will have to go back to localhost:8080/app1 and use the mod_proxy as you did...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts