tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aphra Behn" <aphra_b...@hotmail.com>
Subject Apache and Tomcat VirtualHost Config Problem
Date Thu, 30 Dec 2004 01:54:42 GMT
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/vhosthowto.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/


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message