LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 11-26-2010, 06:14 AM   #1
akash_softnotions
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Rep: Reputation: 0
Smile forwarding an application having port id 8080 to 80 using httpd.conf


Hi all,
I am a network/system Administrator in an avg. based company, we are using Cent Os as servers. We are developing applications in both php & java, for java we are using apache tomcat as server (port number 8080) & for php we are using apache as server (port 80). Php applications are uploaded in the server and giving the link to our clients like localhost.com/chrome. Now we are planning to give the java based application for testing purpose to clients & can give the application link to client as localhost.com:8080/mozilla. Is it is possible to change the link localhost.com:8080/mozilla to localhost.com/mozilla with out changing the portnumber of apache tomcat server & without interrupting the php applications, that means our clients can access php application as localhost.com/chrome & java application as localhost.com/mozilla in the same server at the same time
 
Old 11-26-2010, 06:57 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
No. If apache is already listening on port 80, you can not run tomcat on the same port. There will be conflict between the two. Port redirection is possible but not in this case where two application will listen on the same port.
 
Old 11-26-2010, 07:50 AM   #3
akash_softnotions
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
Wink

Quote:
Originally Posted by linuxlover.chaitanya View Post
No. If apache is already listening on port 80, you can not run tomcat on the same port. There will be conflict between the two. Port redirection is possible but not in this case where two application will listen on the same port.


Actually i heared that we can forward the request which is coming to port 80 (incomming request) to port 8080 using httpd.conf
 
Old 11-26-2010, 08:03 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You can use mod_jk, to make apache use tomcat when it has to serve jsp pages.

Regards
 
Old 11-27-2010, 12:49 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
But apache is not serving jsp pages. Apache is serving php pages and tomcat is serving jsp. Two different applications on same port for different functions? They would collide.
 
Old 11-27-2010, 12:51 AM   #6
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Quote:
Originally Posted by akash_softnotions View Post
Actually i heared that we can forward the request which is coming to port 80 (incomming request) to port 8080 using httpd.conf
You can configure apache to use what ever port you want to. But if a port is already occupied by another application, tomcat here, how will apcahe listen on it? And because apache is serving php pages, you can not use mod_jk like the bathory said. Either of two will listen on 8080 not both.
 
Old 11-27-2010, 02:55 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
@chaitanya
Quote:
You can configure apache to use what ever port you want to. But if a port is already occupied by another application, tomcat here, how will apcahe listen on it? And because apache is serving php pages, you can not use mod_jk like the bathory said. Either of two will listen on 8080 not both.
You are wrong.
Apache listens on its own port (80) and tomcat on its own (8080). When a request for a jsp page comes to apache, it passes the request to tomcat, tomcat does the job, returns the resultsto apache and apache display them on a web page.
You can read the mod_jk documentation for details.
Also serving php pages is not a problem at all. Apache can serve both .php and .jsp pages just fine using the respective modules.

@OP
There is also mod_proxy that can be used in your case, so it make apache work as a reverse proxy for tomcat, but it's a bit slower that mod_jk. If mod_proxy is already installed in your Centos box, you can try to use this instead of mod_jk to do what you want

Regards
 
1 members found this post helpful.
Old 11-27-2010, 02:59 AM   #8
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Thanks for confirming. I misunderstood the docs.
 
Old 11-27-2010, 08:40 AM   #9
akash_softnotions
LQ Newbie
 
Registered: Oct 2009
Posts: 23

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Hi,

You can use mod_jk, to make apache use tomcat when it has to serve jsp pages.

Regards
Hi all thanks for all of your quick response, can u tel me how can i use mod_jk means configuration for this task..
 
Old 11-27-2010, 11:19 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

There are lots of tutorials about configuring apache with mod_jk. IMHO this is the most comprehensive, but it's written for debian. Or you can use this that is written specifically for Centos.
Since you have already a working apache and tomcat, you can focus on mod_jk apache configuration. Just note that in your case you have to use:
Code:
JkMount  /mozilla/* ajp13
so anything under the URI /mozilla will be served by the specified worker (ajp13 in this case)

Regards
 
  


Reply



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
web application on port 8080 fiacobelli Linux - Server 8 10-02-2008 11:21 AM
Iptables port forwarding is not working 8080 to 80 linux_man_2004 Linux - Networking 13 04-14-2008 01:10 PM
access 8080 web server port through squid running on 8080 sunethj Linux - Networking 11 05-18-2007 02:38 AM
port forwarding apache from 80 to 8080 chess Linux - General 11 09-27-2005 02:21 PM
another httpd port forwarding question dsp444 Linux - Networking 3 01-19-2005 07:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration