Mike Curwen wrote:


So it's gonna be something like:


The Apache Vhost:
<VirtualHost xxx.xxx.xxx.xxx>
   JKMount /*.jsp tomcat1
   JKMount /fooservlet tomcat1
   DocumentRoot /home/webhome/atm/htdocs/
   ServerName www.foo.com
   ServerAlias foo.com
   ErrorLog /var/log/atm/error_log
   CustomLog /var/log/atm/access_log combined
</VirtualHost>

relates to the TC Host:
<Host name="www.foo.com" debug="0" appBase="webapps" unpackWARs="true">
 <Alias>foo.com</Alias>
 <Context path="" docBase="home/webhome/atm" debug="0"
reloadable="true"/>
</Host>

Yeah, but I typically make DocumentRoot = ROOT docBase. So on my servers I have something like this:


<Host name="www.VIRTHOST.com" debug="1" appBase="VIRTHOST" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="VIRTHOST" debug="0" reloadable="true">
</Context>
</Host>


and

<VirtualHost *>
    ServerName www.VIRTHOST.aas.com
    DocumentRoot /usr/local/jakarta-tomcat-4.1.27/VIRTHOST/VIRTHOST

    # Static files
    Alias / "/usr/local/jakarta-tomcat-4.1.27/VIRTHOST/VIRTHOST"

    <Directory "/usr/local/jakarta-tomcat-4.1.27/VIRTHOST/VIRTHOST">
        Options Indexes FollowSymLinks
        DirectoryIndex index.jsp
    </Directory>

    # Deny direct access to WEB-INF and META-INF
    <Location "/WEB-INF/*">
        AllowOverride None
        deny from all
    </Location>
    <Location "/META-INF/*">
        AllowOverride None
        deny from all
    </Location>

    JkMount /* ajp13
</VirtualHost>

Which makes the following dir structure possible:

appBase
$CATALINA_HOME/VIRTHOST

Apache DocumentRoot, and TC root Context, path="", docBase="VIRTHOST":
$CATALINA_HOME/VIRTHOST/VIRTHOST

other Context, path="/SOME_OTHER_APP", docBase="SOME_OTHER_APP":
$CATALINA_HOME/VIRTHOST/SOME_OTHER_APP

Yes, #2 above is redundant with having the same dir name twice, but it makes sense to me. You could just as easily change it to ROOT or something else, but in my case, with many virtual hosts, I found myself saying "ok, this is ROOT, but WHICH ROOT?". Using the domain name as the actual name of the directory for the root web app gets rid of this problem.

For other Contexts, you just add additional Alias commands to httpd.conf to get Apache to recognize dirs on the same level as the DocRoot instead of sub-dirs.

Is that correct?  In this case, I'm replacing /ATM and /BDG apps with to
Hosts under TC, with the default Context set to be a separate instance
of that 'common' app.

Pretty much, I would just watch the DocumentRoot and Alias in httpd.conf, they can play tricks on you if you have them pointing to directories one level above or below your Context's docBase.


I'm wondering about this from workers.properties:

worker.list=tomcat1
worker.tomcat1.host=localhost
Will I need to define a new work for each new host in TC,or can I supply
a comma separated list to the worker.tomcat1.host entry?

No, you only need one worker. ".host" = "location of machine running Tomcat", it does not need to match any virtual host name. I used to think it did, back in the day, but I have since seen the error of my ways and have come back to the straight and narrow. A basic 4-line workers.properties will work for many virtual hosts. I have servers with 5, 8, and 22 virtual hosts, all using one worker per physical server with no problems.


Thanks very much John. :)

Glad to help, if I am. Have fun.


John




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



Reply via email to