LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 07-20-2010, 07:31 AM   #1
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 38
using Apache as a front end to a running Tomcat instance


Hi,
I am having a problem.
I use Ubuntu 10.04 server edition.
Two computers on LAN one with Public Ip A other with local (Class C IP)say it B


With a third computer in same subnet I can access a TomCat application running on B as http://Ip of B:8080/application

I want to use A as a Reverse Proxy for this application to be reachable from internet.

So on Googling I came across some thing known as mod_ajp

I enabled that on my Server A as
a2enmod proxy
a2enmod proxy_ajp
a2enmod headers

but after that I am not able to understand as how do I define vhost to be able to forward HTTP request which come on A as
www.myserver.com/app
to B which I can see internally as http://Ip of B:8080/application so Tomcat on B handles this.
 
Old 07-20-2010, 08:12 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,884

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Hi again,
Try the usual reverse proxy setup on apache:
Code:
ProxyPass /app  http://x.x.x.x:8080/app
ProxyPassReverse /app  http://x.x.x.x:8080/app
Regards
 
Old 07-20-2010, 08:49 AM   #3
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 38
Hi actually the reason I asked this problem is I had tried what you are saying.
When I had used it as
Code:
ProxyPass /app  http://x.x.x.x:8080/app
ProxyPassReverse /app http://x.x.x.x:8080/app
on internet if a client browser requested some thing as
http://www.mydomain.com/app/path/to/some/image/

I expect it to internally be forwarded as

Code:
 /app  http://x.x.x.:8080/app
in the URL where ever application at
is having an element in path as /app then it is able to connect but there
are many requests which are generated at B as
Code:
GET /library/skin/default/portal.css
GET /portal/styles/portalstyles.css
GET /library/js/jquery.js
which are not having /app word in URL path so what happens is
if a requests is
http://www.mydomain.com/app/path/to/some/image/
it is served but if a request for

http://www.mydomain.com/app
is generating a URL as
http://www.mydomain.com/library/js/jquery.js
then the request dies at A itself since /library would not be Proxied to B.
My problem is the application is generating how many URL's like this that is not known to me.
Some one suggested me to use Apache as a front end to Tomcat so I googled across and came some links.
Tried some configurations which I think were wrong so wanted if this way some one has used and they can share how they did it.
 
Old 07-20-2010, 09:13 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,884

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Can't you configure the backend application, so that it's aware it's running behind a proxy?
Quote:
Some one suggested me to use Apache as a front end to Tomcat so I googled across and came some links.
Recently I had to setup a jira server (that is a tomcat running a custom app named jira), using apache as a reverse proxy and came into this page. For my case it was of no use, but I hope that it helps in yours

Regards
 
Old 07-20-2010, 09:32 AM   #5
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by bathory View Post
Can't you configure the backend application, so that it's aware it's running behind a proxy?
Well even I am searching for this.
Thanks for your link I will try it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Nginx Catch-All Host As Front End To Apache For ISPConfig 3 On Debian Lenny LXer Syndicated Linux News 0 05-20-2010 07:00 PM
Mythbuntu front-end and back-end questions... Liambiscuit Linux - Software 4 09-28-2008 05:11 PM
Multiple Apache - Front-end & Back-end in one server grant-skywalker Linux - Server 3 08-27-2008 02:04 PM
Apache+php => database front-end sylvaticus Linux - Server 0 01-09-2007 08:28 AM
running 2 instance of apache in one box suprateemdas Linux - Networking 1 02-23-2006 07:17 AM


All times are GMT -5. The time now is 04:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration