Omg I must be tired...

Ex-ay on the reply-ay...  (can you tell I'm tired??)

Final configuration:

/tomcat_home/conf/server.xml
<!-- ip 123.234.345.1 -->
 <Host 
   name="domain1.com" 
   appBase="/home/web/domain1.com/webapps"     ~~~  no directory after
webapps
   unpackWARs="true" 
   autoDeploy="true">
 </Host>


Webapp starts fine, serves fine... rest of previous is okay - just the
server.xml section

~LZM~

-----Original Message-----
From: Lessie Z. Mitch [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 26, 2008 1:33 PM
To: 'Tomcat Users List'
Subject: RE: Virtual Hosts: path="/" without using ROOT folder?

This is going to be long... so bear with me.



My want was to name the context xmls something other than "ROOT". 

In a previous setup I had with TC5.5.16, my contexts were actually in the
server.xml document - which we all know is really a bad thing. I had other
webapps running on the same host so when accessing them will be with a root
domain and then subapps which are explicitly named in the url. We did not
want to use "ROOT" as there are several hosts and "ROOT" gets confusing.

Keep in mind all .war files extract their own directories in each instance
(thus directories being explicit).

Example 3 virtual hosts:
domain1
domain2
domain3

All needing to be separate due to SSL issues, thus had IP structure defined
in Apache (yet another story - will stick to TC configurations)


OLD SETUP 

/tomcat_home/conf/server.xml
<!-- ip 123.234.345.1 -->
<Host 
   name="domain1.com" 
   appBase="/home/web/domain1/webapps/domain1"
   unpackWARs="true" 
   autoDeploy="true">
     <Context path="/"
       docBase="/home/web/domain1/webapps/domain1"
       reloadable="true">
     </Context>
     <Context path="/wiki1"
       docBase="/home/web/domain1/webapps/wiki1"
       reloadable="true">
     </Context>
     <Context path="/forum1"
       docBase="/home/web/domain1/webapps/forum1"
       reloadable="true">
     </Context>
</Host>

<!-- ip 123.234.345.2 -->
<Host 
   name="domain2.com" 
   appBase="/home/web/domain2/webapps/domain2"
   unpackWARs="true" 
   autoDeploy="true">
     <Context path="/"
       docBase="/home/web/domain2/webapps/domain2"
       reloadable="true">
     </Context>
     <Context path="/wiki2"
       docBase="/home/web/domain2/webapps/wiki2"
       reloadable="true">
     </Context>
     <Context path="/forum2"
       docBase="/home/web/domain2/webapps/forum2"
       reloadable="true">
     </Context>
</Host>

<!-- ip 123.234.345.3 -->
<Host 
   name="domain2.com" 
   appBase="/home/web/domain3/webapps/domain3"
   unpackWARs="true" 
   autoDeploy="true">
     <Context path="/"
       docBase="/home/web/domain3/webapps/domain3"
       reloadable="true">
     </Context>
     <Context path="/wiki3"
       docBase="/home/web/domain3/webapps/wiki3"
       reloadable="true">
     </Context>
     <Context path="/forum3"
       docBase="/home/web/domain3/webapps/forum3"
       reloadable="true">
     </Context>
</Host>

Physical Directories:
Home
\__web
   \__domain1
      \__logs
      \__webapps
         \__domain1
         \__wiki1
         \__forum1
   \__domain2
      \__logs
      \__webapps
         \__domain2
         \__wiki2
         \__forum2
   \__domain3
      \__logs
      \__webapps
         \__domain3
         \__wiki3
         \__forum3


I didn't use anything "ROOT" for the server.xml explicitly called out my
contexts and segregated them. I will note that this was a stable
configuration until about the beginning of December08. I don't know what
happened, but my server became unstable, and eventually had a memory
melt-down (we called it a stroke). I had to totally redo the server - from
scratch. 

So now I move the contexts out of the server.xml into this recommended
configuration. Keep in mind, I am STILL working with war files that extract
to directories.


/tomcat_home/conf/server.xml
<!-- ip 123.234.345.1 -->
 <Host 
   name="domain1.com" 
   appBase="/home/web/domain1.com/webapps/domain1"
   unpackWARs="true" 
   autoDeploy="true">
 </Host>
<!-- ip 123.234.345.2 -->
 <Host 
   name="domain2.com" 
   appBase="/home/web/domain2.com/webapps/domain2"
   unpackWARs="true" 
   autoDeploy="true">
 </Host>
<!-- ip 123.234.345.3 -->
 <Host 
   name="domain2.com" 
   appBase="/home/web/domain3.com/webapps/domain3"
   unpackWARs="true" 
   autoDeploy="true">
 </Host>

Context files for domain1 (will only do domain1 as the other two are
mimicked)
/tomcat_home/conf/Catalina/domain1.com/ROOT.xml  ~~ this is so that when
type http://domain1.com/ site will appear
<Context
          docBase="/home/web/domain1.com/domain1"
          reloadable="true">
</Context>
/tomcat_home/conf/Catalina/domain1.com/wiki1.xml  ~~ this is so that when
type http://domain1.com/wiki this sub-site will appear
<Context
          docBase="/home/web/domain1.com/wiki1"
          reloadable="true">
</Context>
/tomcat_home/conf/Catalina/domain1.com/form1.xml  ~~ this is so that when
type http://domain1.com/forum this sub-site will appear
<Context
          docBase="/home/web/domain1.com/forum1"
          reloadable="true">
</Context>

Physical directory
Home
\__web
   \__domain1.com
      \__domain1   ~~~ from war located in webapps, moved it out as war
extracts into webapps
      \__wiki      ~~~ from war located in webapps, moved it out as war
extracts into webapps
      \__forum     ~~~ from war located in webapps, moved it out as war
extracts into webapps
      \__webapps
      \__logs

NOTE: .war files are still inside the webapps directory and had to be moved
out manually to follow Mark's recommended configuration or static resources
are not loaded.

Rinse & repeat for other domains

This is now working on my server. Although not exactly what I wanted... 
1-had to move extracted war directories OUT of webapps
2-ROOT context in /tomcat_home/conf/Catalina/domain1 directory (using that
"ROOT" name)


I did try it by naming the context file, but then had to explicitly call up
my site in the browser as such: http://domain1.com/domain1 and that is
undesirable.

One thing that I thought of is to perform a "redirect" from an index.jsp
file, but then that starts to get a bit confusing and once again
undesirable.

Why does my original configuration not work anymore? I will keep Mark's
recommended configuration but would like to know they "why" behind the
"how". Helps me understand when launching other sites on this server (there
will be another 4 virtual hosts, each serving up 3 or 4 webapps).


Hope this helps you some ahnf (op) and Jeff... I know this thread helped me.


Now, I go fight with the mod_jk.... 



~LZM~










-----Original Message-----
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 26, 2008 10:41 AM
To: Tomcat Users List
Subject: Re: Virtual Hosts: path="/" without using ROOT folder?

Lessie Z. Mitch wrote:
> Sorry.. didn't finish... (hit the damned button)
> 
> And my application context.xml files would read something like...

No - completely wrong. In short (just doing one host) you want something
like:

/tomcat_home/conf/server.xml
<!-- virtual host mywebapp1 -->
       <Host
           name="mydomain1.net"
           appBase="home/web/mydomain1.net/webapps"
           unpackWARs="true"
           autoDeploy="true">
       </Host>

Context file location (for ROOT webapp):
/tomcat_home/conf/Catalina/mydomain1.net/ROOT.xml


Contents of .../mydomain1.net/ROOT.xml:
<Context path=""
       docBase="/some/other/path/foobar.war"
    reloadable="true">
</Context>

The docBase *must not* be under the appBase (home/web/mydomain1.net/webapps)

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date: 2/26/2008
9:08 AM
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date: 2/26/2008
9:08 AM
 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date: 2/26/2008
9:08 AM
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1299 - Release Date: 2/26/2008
9:08 AM
 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to