Does anyone know how to do what he is suggesting? What lines should be inserted or edited in these files to differentiate the requests for jsp for each virtual host? Or does anyone know any better documentation that explains how to do this?

From: "Roberto Rios" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
To: "'Aphra Behn'" <[EMAIL PROTECTED]>
Subject: RES: Apache and Tomcat VirtualHost Config Problem
Date: Thu, 30 Dec 2004 10:59:16 -0200

Hi,

Looking into your apache config, every jsp request that arrives to it
will be forwarded to "ajp13:localhost:8009".

In your tomcat config you are telling to tomcat that every request that
arrives for www.home.net or localhost or www or 10.0.0.10 will be
handled by the application in "/opt/jakarta-tomcat-5.0.28/webapps/home".

So, the application in "/opt/jakarta-tomcat-5.0.28/webapps/sample" will
NEVER be reached...

I'm not an expert, but I think that the only way to do what you want, is
doing some kind of differentiation between the requests for home and
sample.

Doing this, apache will be able to know to each tomcat host forward the
requests.

Bob

-----Mensagem original-----
De: Aphra Behn [mailto:[EMAIL PROTECTED]
Enviada em: quarta-feira, 29 de dezembro de 2004 23:55
Para: tomcat-user@jakarta.apache.org
Assunto: Apache and Tomcat VirtualHost Config Problem

Hi,

I am currently using Apache httpd 2.0.52, Tomcat 5.0.28 and mod_jk2
configured with workers2.properties and so that tomcat can listen to
apache requests.  I want Apache httpd to serve static files and Tomcat
to serve dynamic files (ex. jsp's).

This all works fine if I have all dynamic files located on the url as
www.mysite.com/home/file.jsp

However, I cannot seem to get the dynamic files to work properly if I
want them to be at the same location on the url as the static files so
that www.mysite.com/file.jsp (served by Tomcat as requested by Apache
httpd) and www.mysite.com/index.htm (served by Apache httpd) coexist
without any problems.

I did come up with a config that works partially for jsps at
www.mysite.com/file.jsp but there are some problems.  This is the main
problem:

Eventhough I am able to access all the jsp page inside
CATALINA_HOME/webapp/home, I am no longer able to access any jsp page
inside other directory such as CATALINA_HOME/webapp/sample directory.

I have included all relevant config settings below this paragraph.
What can I do diffrently so that Apache can make a direct request to
both CATALINA_HOME/webapp/home and CATALINA_HOME/webapp/sample instead
of just one?  It seems to me that with my original setting (above
mentioned as www.mysite.com/home/file.jsp), requests from Apache will
start from CATALINA_HOME/webapp and start going through different
directory and display it through the url each time it enter a
subdirectory.  However, with my current setting, instead of starting
at CATALINA_HOME/webapp, I just start at CATALINA_HOME/webapp/home, so
eventhough I make a request from www.mysite.com, "home" does not show
up anymore, but that also makes it impossible to access files from a
directory such as CATALINA_HOME/webapp/sample.  What kind of
configuration do I need to make Apache access a jsp page from Tomcat
without showing up a long url path but instead just something like
www.mysite.com/file.jsp no matter which folder the jsp page is located
inside tomcat?

Here are the relevant config lines:

------------------------------------------------------------------------
-------------------------------
1)Inside server.xml, I enter the following:
      <Host name="www.home.net" debug="0"
              appBase="/opt/jakarta-tomcat-5.0.28/webapps/home"
               unpackWARs="true" autoDeploy="true">
              <Alias>localhost</Alias>
              <Alias>www</Alias>
              <Alias>10.0.0.10</Alias>
              <Context path="" docBase="" debug="1"/>
              <Valve
className="org.apache.catalina.valves.AccessLogValve"
               directory="logs"  prefix="home_access_log." suffix=".txt"
               pattern="common" resolveHosts="false"/>
      </Host>

      <Host name="www.root.net" debug="0"
              appBase="/opt/jakarta-tomcat-5.0.28/webapps/sample"
              unpackWARs="true" autoDeploy="true">
              <Context path="" docBase="" debug="1"/>
              <Valve
className="org.apache.catalina.valves.AccessLogValve"
               directory="logs"  prefix="cust2_log." suffix=".txt"
               pattern="common" resolveHosts="false"/>
      </Host>

2) Inside worker2.properties, I include the following:
      uri:www.home.net/*.jsp]
      worker=ajp13:localhost:8009

      [uri:www.sample.net/*.jsp]
      worker=ajp13:localhost:8009

3)  Inside httpd.conf, I include the following:
<VirtualHost 10.0.0.10:80>
      DocumentRoot /usr/local/httpd-2.0.52/htdocs/www.mysite.com
      ServerName www.mysite.com
      <Location "/*.jsp">
              JkUriSet worker ajp13:localhost:8009
      </Location>
</VirtualHost>
------------------------------------------------------------------------
-------------------------------

If anybody knows of a great source of documentation on this I would
like to know.  I have searched online and read through a lot of
documentation such as  "Apache 2.0.43 - Tomcat 4.1.12 - jk2 - virtual
host HOWTO" at
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/jk2/printer/vhosthow
to.html,
document about mod_jk2 at http://rimuhosting.com/mod_jk2.jsp  and at
http://www.pixelfreak.net/howto/apache2_jk2_tomcat/socket.html,
document about server.xml at
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/host.html,
document about virtual host  at
http://httpd.apache.org/docs-2.0/mod/core.html#virtualhost .

Thanks in advance for your help!

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to