tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wynter" <da...@roamware.co.uk>
Subject RE: 2 VirtualHosts same IP address and port on Tomcat not working
Date Thu, 21 Aug 2003 22:35:42 GMT
Hi John,

Thanks for the pointers. I found a good tutorial on vhosts but using jk2 in
the Tomcat 4.1 docs. So it helped a little. I have change to using
DocumentRoot, less confusing. I also tried full paths instead of relative. I
had removed the Context entries because it meant I could at least type in
the full servlet URL and see the site, with the ones I had (which must have
been wrong) I couldn't.

Anyway I am at the stage where using the example files I am forbidden (403)
from seeing www.stpenable.com or www.roamware.co.uk I think because of the
<Directory /> entry. But I can see the /se servlet with the full URL but not
rwtransform or rwsite webapps.

Here is the bottom of my httpd.conf. I think i need to change the overall
DocumentRoot to /usr/local/jakarta-tomcat-4.1.12/webapp2/ , this directive
is easy to understand in the context of serving up static pages, but not
where all content is dynamically served by a servlet? I also think I need to
get rid of the <Directory /> entry and I might get further along.

-------------------->

DocumentRoot "/usr/local/jakarta-tomcat-4.1.12/webapp2/se"

<Directory /usr/local/jakarta-tomcat-4.1.12/webapp2/se>
    Options None
    AllowOverride None
</Directory>

DirectoryIndex index.html index.vm

<Directory />
    Options None
    AllowOverride None
</Directory>

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

<Location /WEB-INF/>
    Order Allow,Deny
</Location>

<Location /META-INF/>
    Order Allow,Deny
</Location>

NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#


JkWorkersFile "/usr/local/tomcat/conf/jk/workers.properties"
JkLogFile "/usr/local/tomcat/logs/mod_jk.log"

JkLogLevel debug

<VirtualHost *>
    ServerName www.stpenable.com

    #################### www.stpenable.com:/se ####################

    ServerAlias localhost
    # Static files
    DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp2

    JkMount /se/servlet/*  ajp13
    JkMount /se/*.vm  ajp13

    #################### www.stpenable.com:/rwtransform ####################

#    JkMount /rwtransform/servlet/*  ajp13
#    JkMount /rwtransform/*.vm  ajp13

</VirtualHost>

<VirtualHost *>
    ServerName www.roamware.co.uk

    #################### www.roamware.co.uk:/rwsite ####################

    # Static files
    DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite

    JkMount /servlet/*  ajp13
    JkMount /*.vm  ajp13
</VirtualHost>

Now my Hosts section of the Server.xml-------------------------->

     <!-- Define the default virtual host -->
      <Host name="www.stpenable.com" debug="0"
appBase="/usr/local/jakarta-tomcat-4.1.12/webapp2"
       unpackWARs="true" autoDeploy="true">

       <Alias>localhost</Alias>

        <!-- Access log processes all requests for this virtual host.  By
             default, log files are created in the "logs" directory relative
to
             $CATALINA_HOME.  If you wish, you can specify a different
             directory with the "directory" attribute.  Specify either a
relative
             (to $CATALINA_HOME) or absolute path to the desired directory.
        -->
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="stpenable_access_log."
suffix=".txt"
                 pattern="common"/>

        <!-- Logger shared by all Contexts related to this virtual host.  By
             default (when using FileLogger), log files are created in the
"logs"
             directory relative to $CATALINA_HOME.  If you wish, you can
specify
             a different directory with the "directory" attribute.  Specify
either a
             relative (to $CATALINA_HOME) or absolute path to the desired
             directory.-->
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="stpenable_log." suffix=".txt"
	        timestamp="true"/>

        <Context path=""
docBase="/usr/local/jakarta-tomcat-4.1.12/webapp2/se" debug="1"/>
        <Context path="/rwtransform"
docBase="/usr/local/jakarta-tomcat-4.1.12/webapp2/rwtransform" debug="1"/>
      </Host>

      <!-- Define the default virtual host -->
      <Host name="www.roamware.co.uk" debug="0"
appBase="/usr/local/jakarta-tomcat-4.1.12/webapp1"
       unpackWARs="true" autoDeploy="true">

        <!-- Access log processes all requests for this virtual host.  By
             default, log files are created in the "logs" directory relative
to
             $CATALINA_HOME.  If you wish, you can specify a different
             directory with the "directory" attribute.  Specify either a
relative
             (to $CATALINA_HOME) or absolute path to the desired directory.
        -->
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="stpenable_access_log."
suffix=".txt"
                 pattern="common"/>

        <!-- Logger shared by all Contexts related to this virtual host.  By
             default (when using FileLogger), log files are created in the
"logs"
             directory relative to $CATALINA_HOME.  If you wish, you can
specify
             a different directory with the "directory" attribute.  Specify
either a
             relative (to $CATALINA_HOME) or absolute path to the desired
             directory.-->
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="roamware_log." suffix=".txt"
	        timestamp="true"/>

        <Context path=""
docBase="/usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite" debug="1"/>

      </Host>

I am understanding a bit more how the connectors work. But I have worked 16
hours a day for the last 2 on this. I need some sleep.

Regards,

David


> -----Original Message-----
> From: John Turner [mailto:tomcat-user@johnturner.com]
> Sent: 21 August 2003 20:39
> To: Tomcat Users List
> Subject: Re: 2 VirtualHosts same IP address and port on Tomcat not
> working
>
>
>
> Did you remove the Context entries for some reason?  They are critical.
>
> Also, in httpd.conf you have:
>
> # Static files
>      Alias /rwsite "/usr/local/tomcat/webapp1/rwsite"
>
> and later
>
>     JkMount /rwsite/servlet/*  worker1
>     JkMount /rwsite/*.vm  worker1
>
> Thus, the URLs that Apache would expect would be:
>
> www.roamware.co.uk/rwsite/rwsite/servlet/rwsite/templates/index.vm
>
> Aside from the three "rwsite" entries this looks pretty convoluted to me.
>
> If you have /rwsite in an Alias in httpd.conf, then your JkMount would
> be, AFAIK:
>
>     JkMount /servlet/*  worker1
>     JkMount /*.vm  worker1
>
> John
>


Mime
View raw message