Thanks for your fast and information-rich answer ;>)

I will consider all your advice but at the moment our system is up and
running
and I will not touch it.

But for debbuging in the future your comments will be very important

take care

stefan



                                                                                       
                                           
                    Jan                                                                
                                           
                    Labanowski           An:     [EMAIL PROTECTED]        
                                           
                    <[EMAIL PROTECTED]>        Kopie:  Jan Labanowski <[EMAIL PROTECTED]>          
                                           
                                         Thema:  Re: Antwort: Re: Newbie: Apache 
Tomcat mod_jk Virtual Hosts                      
                    13.08.01                                                           
                                           
                    14:05                                                              
                                           
                    Bitte                                                              
                                           
                    antworten an                                                       
                                           
                    tomcat-user                                                        
                                           
                                                                                       
                                           
                                                                                       
                                           




On Mon, 13 Aug 2001 [EMAIL PROTECTED] wrote:

>
> Hi Jan,
>
> I 've got an additional question.
>
> You said, that after implementing virtual host in apache you do not need
to
> specify them in the tomcat apache is connecting to.
> Wouldn't your example contexts be mapped to any single virtual host
> specified in apache?

Virtual host is resolved at the time when connection is being made
between the Web browser and Web server. Only at this moment
the Web server knows the IP address, Host name, and the port to which
the connection was made.

If you want particular virtual host to access particular context
in Tomcat, you need to put all the instructions (found in
mod_jk.conf) within the block of your virtual host in the httpd.conf
file, and do not put those instructions outside the
<VirtualHost>....</VirtualHost> block.
I mean all the instructions, beside maybe
LoadModule jk_module libexec/mod_jk.so
which should be put BEFORE LoadModule rewrite_module
The directives:
JkWorkersFile , JkLogFile , JkLogLevel , Alias , <Directory ..>,
JkMount , JkMount <Location ...>
should be put inside the VirtualHost block, and, unfortunately, the
simple Include mod_jk.conf at the end of httpd.conf will not work.
You have to edit the httpd.conf manually. The stuff which you put outside
<VirtualHost> blocks is available to all virtual hosts defined in
httpd.conf

>
> The only way we could get rid of that behaviour was , to enclose the
> contexts in server.xml
> with the appropriate virtual host tags.

This may have worked (I did not try) for some reasons since some
information
about the host is passed from Apache to Tomcat with the request
in header lines, but it would only work for contexts which
are not automatically deployed in TOMCAT_HOME/webapps directory
and only for certain types of virtual hosts (read documentation on
virtual hosts on www.apache.org to see that there are many ways in
which virtual hosts can be specified).

Moreover, you can start serveral tomcats and attach them to different
server.xml/workers.properties with different connector port,
and each of your VirtualHosts can talk to its own tomcat.


>
>
>
>
>                     Jan
>                     Labanowski           An:
[EMAIL PROTECTED]
>                     <[EMAIL PROTECTED]>        Kopie:  Jan Labanowski
<[EMAIL PROTECTED]>
>                                          Thema:  Re: Newbie: Apache
Tomcat mod_jk Virtual Hosts
>                     13.08.01
>                     03:59
>                     Bitte
>                     antworten an
>                     tomcat-user
>
>
>
>
>
>
> On Sun, 12 Aug 2001 [EMAIL PROTECTED] wrote:
>
> > So would you say that this entry in the server.xml is unnecessary:
> >
> > server.xml:
> >
> > >         <Host name="www.neckers.com" >
> > >            <Context path=""
> > >                     docBase="/home/vs04025/jspwebapps" />
> > >  crossContext="false"
> > >                   debug="0"
> > >                   reloadable="true" >
> > > </Context>
> > >
> > >         </Host>
>
>
> Again... Without knowing what you want to do, it is hard to advise.
> The <Host>....</Host> if for setting virtual hosts in Tomcat.
> You say, you want to connect Tomcat to Apache.
> Then you should do virtual hosts in Apache, not in Tomcat.
> In Tomcat server.xml, you should only provide the connector for Apache,
> say:
>         <!-- Apache AJP13 support.           -->
>         <Connector className
="org.apache.tomcat.service.PoolTcpConnector">
>             <Parameter name="handler"
>        value
="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
>             <Parameter name="port" value="8007"/>
>         </Connector>
>
> (the port 8007 should be the same as in workers.properties)
>
> and you should provide contexts, say:
>         <Context path="/examples"
>                  docBase="webapps/examples"
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
>         <Context path="/jspwebapps"
>                  docBase="/home/vs04025/jspwebapps" />
>                  crossContext="false"
>                  debug="0"
>                  reloadable="true" >
>         </Context>
>
>
> So you can access them as:
>    http://my.machine.com/examples
> and
>    http://my.machine.com/jspwebapps
>
> (assuming that your appache listens to html on port 80).
>
>
> Jan
>
>
> >
> > Orlando
> >
> > Jan Labanowski wrote:
> >
> > > On Sat, 11 Aug 2001 [EMAIL PROTECTED] wrote:
> > >
> > > > I am trying to get tomcat to work according to the
> tomcat-apache-howto:
> > > >
> > > > I want apache to serve static files as it has been doing and pass
> .jsp and servlet
> > > > requests to tomcat:
> > > >
> > > > How will they work together?
> > > >
> > > >             In a nutshell a web server is waiting for requests.
When
> these
> > > > requests arrive the server does whatever is needed
> > > >             to serve the requests by providing the necessary
content.
> Adding
> > > > Tomcat to the mix may somewhat change this
> > > >             behavior.  Now the web server needs to perform the
> following:
> > > >
> > > >                   Before the first request can be served, Apache
> needs to load a
> > > > web server adapter library (so Tomcat can
> > > >                   communicate with Apache) and initialize it.
> > > >                   When a request arrives, Apache needs to check and
> see if it
> > > > belongs to a servlet; if so it needs to let the
> > > >                   adapter take the request and handle it.
> > > >
> > > >             We'd like Apache to handle our static content, such as
> images and HTML
> > > > documents, and forward all requests for
> > > >             dynamic content to Tomcat.  More specifically, we need
> answers to the
> > > > following questions:
> > > >
> > > >                   1.    How will Apache know which request / type
of
> requests
> > > > should be forwarded to Tomcat?
> > >
> > > ==================================
> > > Through the stuff which you provided in mod_jk.conf file which is
> usually
> > > included in the Apache's httpd.conf at the end.
> > > This file contains instructions which tell Apache which stuff to
> > > process by itself and which stuff to send to Tomcat:
> > > For example:
> > >
> > > JkWorkersFile
> /usr/local/tomcat_3.2.1/tomcat-3.2.1/conf/workers.properties
> > > # Tells where is the workers properties
> > >
> > > JkLogFile /usr/local/tomcat_3.2.1/tomcat-3.2.1/logs/mod_jk.log
> > > # where is the log file to write to
> > >
> > > Alias /examples
"/usr/local/tomcat_3.2.1/tomcat-3.2.1/webapps/examples"
> > > That URIs which start from /examples are located in this physical
> directory
> > >
> > > <Directory "/usr/local/tomcat_3.2.1/tomcat-3.2.1/webapps/examples">
> > >     Options Indexes FollowSymLinks
> > > </Directory>
> > > That this directory should use these options
> > >
> > > #
> > > # The following line mounts all JSP files and the /servlet/ uri to
> tomcat
> > > #
> > > JkMount /examples/servlet/* ajp13
> > > That URIs with this structure should be sent to Tomcat
> > >
> > > JkMount /examples/*.jsp ajp13
> > > That URIs with this structure should be sent to Tomcat
> > > ====================================
> > >
> > > >                   2.    How will Apache forward these requests to
> Tomcat?
> > >
> > > ===================================
> > > You start Tomcat before apache. Tomcat runs and opens the listening
> socket
> > > on the port which you specified in server.xml. Tomcat acts as TCP
> server
> > > and LISTENS for requests from Apache.
> > > Then you start Apache. Apache knows now (mod_jk.conf) where to send
> > > the requests for JSP and servlets. When request arrives, Apache sends
> > > the request to Tomcat (Apache is a client in the Apache Tomcat
> communication).
> > > The Tomcat and apache talk via special language called ajp13 (in this
> case)
> > > and after Tomcat is finished, it send the response back to Apache,
and
> > > Apache send it back to the browser which requested it.
> > > ===================================
> > >
> > > >                   3.    How will Tomcat accept and handle these
> requests?
> > >
> > > Tomcat can be a Web server, but in the case of its interaction with
> Apache
> > > these functions are not used,  and in fact should be blicked in
> server.xml.
> > > When Tomcat works with Apache, they talk to each other via special
> protocol
> > > using the TCP Socket. The protocol is not HTTP, it is Apache JServ
> Protocol
> > > or whatever it was called in the Middle Ages. Tomcat is a server in
> this
> > > case, and does all the processing of JSP and Servlets for Apache.
> > > Than it returns resulting HTML to Apache, so Apache can send it to
the
> > > browser which requested it.
> > >
> > > ========================
> > >
> > > >
> > > >             The majority of our time will be spent dealing with
> points 1 and 2; 3
> > > > should be a snap!
> > > >
> > > >       What's required to pull this off?
> > > >
> > > >             Answers to the above three questions!
> > > >
> > > >                   1.    Modify Apache's httpd.conf file.
> > > >                   2.    Install a web server adapter.
> > > >                   3.    Modify Tomcat's server.xml file.
> > > >
> > > >             It is assumed that you are comfortable modifying the
> configuration of
> > > > Tomcat and Apache separately before you've
> > > >             attempted to integrate the two.  As such, we speak in
> > > > Tomcat/Apache/Servlet lingo, not pausing to explain what's
> > > >             already been taught in their respective user guides.
> Details on Tomcat
> > > > setup can be found in the Tomcat User's
> > > >             Guide, while Apache configuration information can be
> found in the
> > > > Apache User's Guide.
> > > >
> > > > Did I misunderstand this howto?
> > > > So do I really need to have tomcat running if I am using mod_jk?
> > >
> > > Yes... mod_jk is just a connector, i.e., connects Apache and Tomcat.
> > > It has no processing functions beside send request to Tomcat, and get
> > > response back from Tomcat. Tomcat does the actual processing. Apache
> > > is just a client of Tomcat for requests which require JSP/Servlets
> > > which Apache does not know how to do.
> > >
> > > >
> > > > Thank you,
> > > >
> > > > Orlando
> > > >
> > > >
> > > > Jan Labanowski wrote:
> > > >
> > > > > I am not sure what you are trying to do...
> > > > >
> > > > > If you want to do virtual hosts in Apache, then do them in
Apache.
> > > > > In this case, Tomcat does not know anything about virtual hosts,
> > > > > and processes stuff which is handled to it via a connector.
> > > > > In the httpd.conf you specify your virtual hosts between the
> > > > >
> > > > > <VirtualHost address:port>
> > > > >
> > > > > Regular stuff like ServerAdmin, DocumentRoot, etc. and
> > > > > stuff, including your mod_jk stuff like:
> > > > >
> > > > > JkWorkersFile path
> > > > > JkLogFile path1
> > > > > JkLogLevel error
> > > > > JkMount /*.jsp ajp13
> > > > > JkMount /servlet/* ajp13
> > > > > Alias /examples
> "/jakarta_3.2.1/jakarta-tomcat-3.2.1/webapps/examples"
> > > > > <Directory
"/jakarta_3.2.1/jakarta-tomcat-3.2.1/webapps/examples">
> > > > >     Options Indexes FollowSymLinks
> > > > > </Directory>
> > > > > JkMount /examples/servlet/* ajp13
> > > > > JkMount /examples/*.jsp ajp13
> > > > > ....
> > > > > </VirtualHost>
> > > > >
> > > > > And on the Tomcat site you do not know anything about virtual
> hosts,
> > > > > since Tomcat processes what it gets from Apache via connector and
> > > > > has no say in how requests are forwarded to it (Apache is the
boss
> here).
> > > > > You do not use the <host> tag in server.xml and use regular
> workers.properties
> > > > >
> > > > > When you do virtual hosts in Tomcat, then you do not use Apache,
> and
> > > > > talk HTTP to the outside world directly. In other words, Tomcat
is
> your
> > > > > web server, and you configure virtual hosts in tomcat, and do not
> talk
> > > > > to apache, but to a client (browser) directly. Then you do not
need
> mod_jk
> > > > > and you do not need Apache. You use Tomcat a standalone Web
server
> which
> > > > > has nothing to do with Apache.
> > > > >
> > > > > On Sat, 11 Aug 2001 [EMAIL PROTECTED] wrote:
> > > > >
> > > > > > I have tried to start tomcat with both a generic server.xml and
> one that
> > > > > > I modified according to the mod_jk-howto and emails from the
> group.
> > > > > > In both instances, the worker.properties file remained the same
> as outlined in
> > > > > > this email thread(see below).
> > > > > > It seems that both setups yield the same logfile output.
However,
> I do not see
> > > > > > any instances of tomcat processes running when using the
modified
> server.xml.
> > > > > >
> > > > > > The only mod to that file being the extra Host entry:
> > > > > >
> > > > > >         <Host name="www.netcrackers.com" >
> > > > > >            <Context path=""
> > > > > >                     docBase="/home/vs04025/jspwebapps" />
> > > > > >  crossContext="false"
> > > > > >                   debug="0"
> > > > > >                   reloadable="true" >
> > > > > > </Context>
> > > > > >
> > > > > >         </Host>
> > > > > >
> > > > > >
> > > > >  ...  rest deleted ....
> > > > >
> > > > > Jan K. Labanowski            |    phone: 614-292-9279,  FAX:
> 614-292-7168
> > > > > Ohio Supercomputer Center    |    Internet: [EMAIL PROTECTED]
> > > > > 1224 Kinnear Rd,             |
http://www.ccl.net/chemistry.html
> > > > > Columbus, OH 43212-1163      |    http://www.osc.edu/
> > > >
> > >
> > > Jan K. Labanowski            |    phone: 614-292-9279,  FAX:
> 614-292-7168
> > > Ohio Supercomputer Center    |    Internet: [EMAIL PROTECTED]
> > > 1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
> > > Columbus, OH 43212-1163      |    http://www.osc.edu/
> >
>
> Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
> Ohio Supercomputer Center    |    Internet: [EMAIL PROTECTED]
> 1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
> Columbus, OH 43212-1163      |    http://www.osc.edu/
>
>
>
>

Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center    |    Internet: [EMAIL PROTECTED]
1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163      |    http://www.osc.edu/




Reply via email to