Re: Tomcat and Apache on the same port?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tony,

Yes.  One physical server and/or network card can support multiple IP 
addresses.  What OS is this?  When you say LAN, is this a corporate LAN or 
a home/isp LAN?  Which versions of apache and tomcat?  proxy_ajp and 
mod_jk are the same thing, only proxy_ajp is for apache 2.2+ and mod_jk 
pre-2.2.

Ok, before we can do anything, you'll need a second static IP address for 
your server.  Then, it needs to get configured on your server.  I'm more 
of a Unix guy, but maybe someone else out here could help out if your 
running windows.

After that...

In apache, you likely have a:

Listen 80

somewhere.  You can change that to:

Listen <ip-address1>:80

without the '<', '>', so that apache will only list on that 
ip-address/port combination.

Likewise, in tomcat, you likely have something like:

<Connector port="80" ...

you can add an address parameter to specify an ip address, like:

<Connector port="80" address="<ip-address2>" ...

Have you ever used the 'netstat' command?  On windows, something like:

netstat -nap tcp

will output something like:

Active Connections

  Proto  Local Address          Foreign Address        State
        .
        .
        .
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING
        .
        .
        .

or on Unix (at least Sun Solaris 10) something like:

netstat -naf inet

On Unix, you might see '*', instead of 0.0.0.0, but they both mean the 
same thing, all address on the server.  If you run netstat before make the 
above apache/tomcat changes, you would see:

  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING

after the changes, it should look like:

  TCP    <ip-address1>:80             0.0.0.0:0              LISTENING
  TCP    <ip-address2>:80             0.0.0.0:0              LISTENING




Please respond to users@xxxxxxxxxxxxxxxx

To:     users@xxxxxxxxxxxxxxxx
cc:      (bcc: Dan Mitton/YD/RWDOE)
Subject:        Re:  Tomcat and Apache on the same port?
LSN: Not Relevant
User Filed as: Not a Record

Hi Dan,

Thanks for the response. So I can have different IP's
for the same physical server how would the client and
the router handle that? I have a static address for my
server on the lan and I redirect my request for port
80 to that IP. What decides the IP to send a request
to the web server versus the Tomcat servlet container?

Sounds good but I am trying to sort through the
details for that configuration.

Also, I am already sending requests to Tomcat via
mod_jk in Apache so not sure what the advantages are
of proxy_ajp.

Many Thanks,
-Tony

--- Dan_Mitton@xxxxxxxxxxxxx wrote:

> Tony,
> 
> The only way to have two services use/listen on the
> same port is to use 
> two different IP addresses, one for each.  Then each
> can listen on port 
> 80.
> 
> A possible, very high effort, alternative would be
> to write a program that 
> would sit in front of both apache and tomcat, that
> could examine the 
> incoming packets and determine to route it to apache
> or tomcat based on 
> the packet content.  I'm talking a very complicated
> program here.
> 
> Apache proxying requests through to tomcat is not
> that expensive overhead 
> wise.  That would really be your best solution. 
> Look at the proxy_ajp 
> module in apache 2.2
> 
> Dan
> 
> 
> 
> Please respond to users@xxxxxxxxxxxxxxxx
> 
> To:     Tomcat Users Group <users@xxxxxxxxxxxxxxxxx>
> cc:     Apache Mailing List <users@xxxxxxxxxxxxxxxx>
> (bcc: Dan 
> Mitton/YD/RWDOE)
> Subject:         Tomcat and Apache on
> the same port?
> LSN: Not Relevant
> User Filed as: Not a Record
> 
> Hi All,
> 
> Is it possible to run Tomcat and Apache on the same
> port? What I want to do is have my website running
> on
> Apache web server or port 80 and also have Tomcat
> running on port 80. That way my web service requests
> do not need to go through Apache web server where
> they
> are redirected to Tomcat.
> I am trying to avoid web service requests going to a
> different port on the client side and getting
> stopped
> by a proxy but perhaps that does not stop http
> requests going another site on port say 81?
> 
> Thanks,
> -Tony
> 
> 
> 
>
____________________________________________________________________________________
> Need a vacation? Get great deals
> to amazing places on Yahoo! Travel.
> http://travel.yahoo.com/
> 
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail:
> users-unsubscribe@xxxxxxxxxxxxxxxx
>    "   from the digest:
> users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail:
> users-help@xxxxxxxxxxxxxxxx
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail:
> users-unsubscribe@xxxxxxxxxxxxxxxx
>    "   from the digest:
> users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail:
> users-help@xxxxxxxxxxxxxxxx
> 
> 



 
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux