I've set up my system so that Apache handles all requests, and forwards to the servlet when the path is www.mysite.com/myservlet/*.
Following are my installation notes. (note that there's a slightly newer version of the JK connector) % tar zxf jakarta-tomcat-connectors-jk2-src-current.tar.gz % cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2 % ./configure --with-apxs2=/usr/local/apache/bin/apxs % make % su % cp ../build/jk2/apache2/mod_jk2.so /usr/local/apache/modules % cp ../build/jk2/apache2/jkjni.so /usr/local/apache/modules make sure that httpd owns the apache directory tomcat/server.xml: make sure that the following connector is uncommented: <Connector className="org.apache.ajp.tomcat4.Ajp13Connector" port="8009" minProcessors="5" maxProcessors="75" acceptCount="10" debug="0"/> create a "workers2.properties" file in /usr/local/apache/conf with the following contents: [logger] level=DEBUG [shm] file=/usr/local/apache/logs/jk2.shm size=1048576 [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 [uri:/myservlet/*] context=/myservlet % touch /usr/local/apache/logs/jk2.shm % chown httpd /usr/local/apache/logs/jk2.shm % chgrp httpd /usr/local/apache/logs/jk2.shm add the following line to /usr/local/apache/conf/httpd.conf: LoadModule jk2_module modules/mod_jk2.so I hope this helps. Daniel > -----Original Message----- > From: Pulkit Singhal [mailto:[EMAIL PROTECTED] > Sent: Sunday, December 25, 2005 1:12 PM > To: Tomcat Users List > Subject: Re: How to forward external-ip-facing requests from > ApacheHTTPServer to Tomcat? > > Hi, > > Thank you for the suggestion :) > I will give it a shot but I am really too deep into my setup > to be doing any big changes or something new! So while I try > to google and learn more about setting up mod_proxy, I would > really appreciate if someone can tell me: > > How do I go about configuring apache to forward the > outside-facing-ip requests to Tomcat through JK connector? > > This should be something pretty standard for anyone who has > ever moved Tomcat from a local testing env. (localhost) to a > production env. (real ip) ...right? > > Thanks, > - Pulkit > > On 12/23/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > use mod_proxy, much easier, and in our tests has proven to scale > > better, and you will wanna look for a directive called > > ProxyHostPreserve so that request.getServerName returns the right > > name, then the IP address will be stored in x-forwarded-for > header in > > the HTTP request. > > > > Filip > > > > > Hello Everyone, > > > > > > I have successfully configured Apache to forward requests to my > > > Tomcat instance. But it does so...only for requests whose IP > > > resolves to > > > 127.0.0.1 > > > > > > If I try to access a page through apache server (that's > actually on > > > tomcat) > > > with the outside-facing-ip of my computer it fails. > > > > > > For example: > > > 1) URL: "http://12.34.56.78:666/blah/serveMe.html" > FAILS with > > a > > > 404 (apache does not forward properly) > > > > > > 2) URL: "http://12.34.56.78:8080/blah/serveMe.html" > SUCCEEDS > > > (tomcat seems to be ok when it gets the request directly, > so it has > > > to > > be > > > a > > > forwarding failure by apache in the previous case) > > > > > > 3) URL: "http://my.domain.com:666/blah/serveMe.html" > SUCCEEDS (I > > have > > > " > > > my.domain.com" mapped to "127.0.0.1" in my windows' hosts file) > > > > > > 4) URL: "http://localhost:666/blah/serveMe.html" > SUCCEEDS > > > > > > I think this happens because the 1st request (the one with the > > > outside facing ip) is not forwarded to Tomcat by apache. > > > a) The apache error logs show that Apache is trying to > look for the > > > page in the wrong place > > > b) The access logs ofcourse show a 404 because it can't find the > > > page to serve > > > > > > Now, I have read a few threads and been on a few forums and > > > apparently > > my > > > worker.properties file is supposed to be as simple as this: > > > ------------------------ > > > worker.list=ajp13 > > > worker.ajp13.port=8009 > > > worker.ajp13.host=my.domain.com > > > worker.ajp13.type=ajp13 > > > ----------------------- > > > > > > I also tried putting my outside-facing-ip and localhost > as values for " > > > worker.ajp13.host" but it didn't seem to make any > difference at all. > > > > > > In that case I must ask all of you: > > > Question 1: How do I go about configuring apache to forward the > > > outside-facing-ip requests to Tomcat? If it is not done in > > > workers.properties...then where is it handled? > > > Question 2: Or am I wrong and it is actually handled by > > > workers.properties? > > > Even then, how? > > > > > > Thanks in advance to all those who answer and all those > who take the > > time > > > to > > > read this. > > > > > > Cheers, > > > - Pulkit > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]