Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Tomcat and Apache on Separate servers

Jacob Kjome

2004-01-06

Replies:

At 01:36 AM 1/6/2004 -0500, you wrote:

>Hi All,
>
>I have what I hope will be a simple question. I have 2 Win 2K boxes. One
>running Tomcat and the other Apache.
>
>How do I deploy a web app on the Tomcat server and configure it to talk to
>the Apache web server on a completely separate box.
>
>Do I need to configure both ends? Does it make sense to split the boxes
>this way just to have Apache server static files?

Here's a copy of information from the list a while back. I would post the
url to the archived message, but I don't have that at the
moment. Attribution of this solution goes to the original poster, not
myself...


Here it goes.................

Machine A (Apache), Machine B (tomcat)
---------------------------------------------

httpd.conf changes...
---------------------
Below # LoadModule foo_module modules/mod_foo.so

Add following lines
#
# Load mod_jk
#
LoadModule jk_module libexec/mod_jk.so
#
# Configure mod_jk
#
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug

Below DocumentRoot "/usr/local/apache/htdocs"

Add following lines...

JkMount /examples ajp13
JkMount /examples/* ajp13

(if you want to configure a application examples running under webapps
on tomcat, just specify /examples, you need not sepcify the full path
of the application)

Then create workers.properties under $Apache_Home$/conf/ like this

# In Unix, we use forward slashes:
ps=/

# list the workers by name
worker.list=ajp13

#
worker.ajp13.port=8009(ajp13 port from server.xml on tomcat machine)
worker.ajp13.host=hostname(Machine B)
worker.ajp13.type=ajp13

(no need to define tomcat_home and java_home parameters here, you define
them on catalina.sh on tomcat machine)

this is all you need to do on apache machine.......

server.xml changes on Machine B(tomcat machine)
------------------------------------------------------

Set the required environment variables JAVA_HOME AND CATALINA_HOME in
$TOMCAT_HOME$/bin/catalina.sh

Commen out the Standalone HTTP port(port 8080) Connector.

<!--
  <Connector
className="org.apache.catalina.connector.http.HttpConnector"
          port="8080" minProcessors="5" maxProcessors="75"
          enableLookups="true" redirectPort="8443"
          acceptCount="10" debug="0" connectionTimeout="60000"/>
-->


Also Comment out the WARP connector

 <Service name="Tomcat-Apache">
<!--
  <Connector
className="org.apache.catalina.connector.warp.WarpConnector"
   port="8008" minProcessors="5" maxProcessors="75"
   enableLookups="true" appBase="webapps"
   acceptCount="10" debug="0"/>
-->


Change the both the <Engine> Tag and <Host> tag defaultHost to tomcat
hostName(ex: tomcat.apache.com)
(This should match with your workers.properties host name.)

<Engine name="Standalone" defaultHost="tomcat.apache.com" debug="0">
 <Host name="tomcat.apache.com" debug="0" appBase="webapps"
unpackWARs="true">
 </Host>
</Engine>

start tomcat and apache, you should be able to access examples from
apache machine....

I have pretty much followed the http://www.ubeans.com/tomcat/
documentation......many many thanks to Pascal Forget.


Let me know, how it goes...............

-Raj




>Thanks for your time,
>
>Regards
>Tomcat-Apache "Newbie"
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
>For additional commands, e-mail: tomcat-user-help@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.