Results 1 to 6 of 6

Thread: Apache2 & multiple java webapps via mod proxy possible?

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Location
    Reading, Berkshire
    Posts
    1,253
    Thanks
    64
    Thanked
    53 times in 34 posts
    • tfboy's system
      • Motherboard:
      • MSI X470 Gaming Plus
      • CPU:
      • AMD Ryzen 7 2700
      • Memory:
      • 2x8GB Corsair Vengeance LPX)
      • Storage:
      • Force MP600 1TB PCIe SSD
      • Graphics card(s):
      • 560 Ti
      • PSU:
      • Corsair RM 650W
      • Case:
      • CM Silencio 550
      • Operating System:
      • W10 Pro
      • Monitor(s):
      • HP LP2475w + Dell 2001FP
      • Internet:
      • VM 350Mb

    Apache2 & multiple java webapps via mod proxy possible?

    Bit of a strange one here, maybe someone can help?

    I'm using both JIRA (bug tracking) and Confluence (wiki) applications from atlassian and I'm hosting them on my server.

    Both of these apps are in fact java apps running on Tomcat.

    Now because I want to run both behind the same server (differentiated by different URL paths) and because Tomcat runs on port 8080 by default and because I need it all accessible from default https (443), I've resorted to using Apache2 running on port 443 and using mod proxy.

    Idea is the following:
    User accesses https://foo.com/jira and this goes to Apache2. Apache2 then proxies to the Tomcat instance running JIRA on, say, port 8080.

    At the same time, a user access https://foo.com/wiki and this goes to the same Apache2 instance. However, we now have a different virtualserver which would pick up the /wiki path and proxy redirect to the Tomcat instance running Confluence on port 8090

    So we have:

    https://foo.com/jira ===> http://localhost:8080/jira and
    https://foo.com/wiki ===> http://localhost:8090/wiki

    Now I've managed to get it workign with JIRA running on SSL and Confluence running on normal HTTP on port 80. But as soon as I try and have them both running on SSL, it all seems to fall apart.

    I don't know whether I need to add a servername or something in apache? my site config files are:

    For JIRA:

    Code:
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    
    <VirtualHost *:443>
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/certs/jira.crt
        SSLCertificateKeyFile /etc/apache2/ssl/private/jira.key
        SSLCertificateChainFile /etc/apache2/ssl/sf_bundle.crt
        ProxyRequests               Off
        ProxyPreserveHost   On
        ProxyPass                   /jira           http://foo.com:8080/jira
        ProxyPassReverse            /jira           http://foo.com:8080/jira
    </VirtualHost>
    And if for Confluence, I have:

    Code:
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    
    <VirtualHost *:80>
        ProxyRequests               Off
        ProxyPreserveHost   On
        ProxyPass                   /wiki           http://foo.com:8090/wiki
        ProxyPassReverse            /wiki           http://foo.com:8090/wiki
    </VirtualHost>
    Then it all works fine.

    But if I change the Confluence one to:

    Code:
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    
    <VirtualHost *:443>
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/certs/jira.crt
        SSLCertificateKeyFile /etc/apache2/ssl/private/jira.key
        SSLCertificateChainFile /etc/apache2/ssl/sf_bundle.crt
        ProxyRequests               Off
        ProxyPreserveHost   On
        ProxyPass                   /wiki           http://foo.com:8090/wiki
        ProxyPassReverse            /wiki           http://foo.com:8090/wiki
    </VirtualHost>
    Then it all falls apart. Both Confluence and JIRA stop working all together.

    I have edited the corresponding server.xml config files for Tomcat for both Jira and Confluence instances to reflect back to the correct port (80 or 443). So it's looking like an apache config problem rather than a Tomcat one.

    Any apache gurus out there with an idea?

  2. #2
    Super Nerd
    Join Date
    Jul 2008
    Location
    Cambridge
    Posts
    1,785
    Thanks
    22
    Thanked
    105 times in 72 posts

    Re: Apache2 & multiple java webapps via mod proxy possible?

    You should check out mod_jk, it's more complicated but much more flexible.

    http://tomcat.apache.org/connectors-doc/

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Location
    Reading, Berkshire
    Posts
    1,253
    Thanks
    64
    Thanked
    53 times in 34 posts
    • tfboy's system
      • Motherboard:
      • MSI X470 Gaming Plus
      • CPU:
      • AMD Ryzen 7 2700
      • Memory:
      • 2x8GB Corsair Vengeance LPX)
      • Storage:
      • Force MP600 1TB PCIe SSD
      • Graphics card(s):
      • 560 Ti
      • PSU:
      • Corsair RM 650W
      • Case:
      • CM Silencio 550
      • Operating System:
      • W10 Pro
      • Monitor(s):
      • HP LP2475w + Dell 2001FP
      • Internet:
      • VM 350Mb

    Re: Apache2 & multiple java webapps via mod proxy possible?

    Thanks KPN

    In fact, managed to fix it, and the solution was really simple I wonder why I didn't think of it first: just have one virtualhost but enumerate both ProxyPass and ProxyReverse in it and it's fine

    I now have an issue with Confluence, but that one's proving to be harder to understand.....

  4. #4
    Super Nerd
    Join Date
    Jul 2008
    Location
    Cambridge
    Posts
    1,785
    Thanks
    22
    Thanked
    105 times in 72 posts

    Re: Apache2 & multiple java webapps via mod proxy possible?

    Quote Originally Posted by tfboy View Post
    Thanks KPN

    In fact, managed to fix it, and the solution was really simple I wonder why I didn't think of it first: just have one virtualhost but enumerate both ProxyPass and ProxyReverse in it and it's fine

    I now have an issue with Confluence, but that one's proving to be harder to understand.....
    Haha I should have spotted that! IIRC Virtualhosts are enumerated and selected in the order they appear, and the first match is used, you should always have a default <Virtualhost _default_:80> but then any after that need to contain a ServerName or ServerAlias to match a different hostname, or they need to be on a different port number, otherwise they'll never be used.

    What you did putting them in the same virtual host is the way to go in your scenario. What's up with Confluence?

  5. #5
    Senior Member
    Join Date
    Jul 2003
    Location
    Reading, Berkshire
    Posts
    1,253
    Thanks
    64
    Thanked
    53 times in 34 posts
    • tfboy's system
      • Motherboard:
      • MSI X470 Gaming Plus
      • CPU:
      • AMD Ryzen 7 2700
      • Memory:
      • 2x8GB Corsair Vengeance LPX)
      • Storage:
      • Force MP600 1TB PCIe SSD
      • Graphics card(s):
      • 560 Ti
      • PSU:
      • Corsair RM 650W
      • Case:
      • CM Silencio 550
      • Operating System:
      • W10 Pro
      • Monitor(s):
      • HP LP2475w + Dell 2001FP
      • Internet:
      • VM 350Mb

    Re: Apache2 & multiple java webapps via mod proxy possible?

    Out of interest, do you know of a site or blog which details these examples clearly? The Apache official doc is very detailed but they don't provide examples to illustrate and I'm not savvy enough to understand it for sure without an example.

  6. #6
    Super Nerd
    Join Date
    Jul 2008
    Location
    Cambridge
    Posts
    1,785
    Thanks
    22
    Thanked
    105 times in 72 posts

    Re: Apache2 & multiple java webapps via mod proxy possible?

    Quote Originally Posted by tfboy View Post
    Out of interest, do you know of a site or blog which details these examples clearly? The Apache official doc is very detailed but they don't provide examples to illustrate and I'm not savvy enough to understand it for sure without an example.
    I get most of my Apache stuff just by googling what I want to do, but I guess you need to know enough about it to know what to search. I picked up Apache by reading other people's existing configs, the Apache docs (there are some examples, and make sure you read the right version docs) and just trial and error really... I guess I'm ~OK~ with it now, but not a guru.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Multiple Java installs
    By Funkstar in forum Software
    Replies: 7
    Last Post: 07-05-2008, 05:15 PM

Posting Permissions

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