Mark -
I run a number my sites under this configuration.  Works great.
Didn't realize it was officially documented though.
Jeff

> -----Original Message-----
> From: Mark Eggers [mailto:its_toas...@yahoo.com]
> Sent: Thursday, February 03, 2011 3:41 PM
> To: Tomcat Users List
> Subject: Re: Tomcat Service configuration for running sites
> 
> This will be long - read at your own risk.
> 
> ----- Original Message Begin ----
> 
> 
> Hi,
> 
> Thanks to all who answered my previous post regarding running Tomcat
> with IIS7.
> 
> I am still quite confused about the whole thing, so I think I should
> try to
> forget about IIS for the time being, and concentrate first on how to
> get Tomcat
> service to serve a java website sitting physically outside of Tomcat's
> installed
> 
> 
> 
> folder.
> 
> BTW, platform is Windows 2008 R2 64bit.
> Tomcat installed is 5.5.32. (In my previous question I installed 6.0.30
> but I
> now realised when the website was running on Linux, my manager was
> using 5.5.23
> and now I can only find 5.5.32 to download. I hope it makes no
> difference).
> 
> 
> For example, Tomcat service is installed on: (... means some more sub
> folders or
> 
> 
> 
> files within):
> C:\Tomcat\
> 
> And the subfolders under this folder are:
> C:\tomcat\bin\...   (contains tomcat5.exe, tomcat5w.exe, and 3 .jar
> files)
> C:\tomcat\common\...
> C:\tomcat\conf\...   (contains catalina.policy, catalina.properties,
> context.xml, logging.properties, server.xml, server-minimal.xml,
> tomcat-users.xml, web.xml)
> C:\Tomcat\conf\Catalina\
> C:\Tomcat\conf\Catalina\localhost
> C:\tomcat\logs
> C:\tomcat\server
> C:\Tomcat\server\classes\
> C:\Tomcat\server\lib\...   (many .jar files in there, e.g.
> catalina.jar)
> C:\Tomcat\server\webapps\...
> C:\tomcat\shared\...
> C:\tomcat\temp
> C:\tomcat\webapps\ROOT\...
> C:\tomcat\work
> 
> My Java web application is placed in:
> C:\WebApp1\
> 
> With subfolders:
> C:\WebApp1\bin\...   (contains tomcat5.exe and tomcat5w.exe and many
> .sh and
> .bat files as we previously start this site using the startup.bat
> before I
> installed the Tomcat service)
> C:\WebApp1\common\...
> C:\WebApp1\conf\...   (contains catalina.policy, catalina.properties,
> context.xml, logging.properties, server.xml, server-minimal.xml,
> tomcat-users.xml, web.xml specifically used by this website)
> C:\WebApp1\conf\Catalina\
> C:\WebApp1\logs\
> C:\WebApp1\server\
> C:\WebApp1\server\lib\...   (many .jar files in there, e.g.
> catalina.jar)
> C:\WebApp1\shared\...
> C:\WebApp1\sslcerts\...   (SSL certificates in here)
> C:\WebApp1\webapps\ROOT\...   (This is the root of the website. E.g.
> default.jsp
> 
> 
> 
> sits in here)
> C:\WebApp1\webapps\ROOT\WEB-INF\classes\...   (The java classes we
> created to be
> 
> 
> 
> used for the website to interact with back-end database)
> C:\WebApp1\webapps\ROOT\WEB-INF\lib\...   (some 3rd party .jar files
> specifically used by this website)
> C:\WebApp1\webapps\ROOT\WEB-INF\web.xml   (contains the listener
> definition,
> points to the listener class, so that when this site starts the
> listener class
> can perform some initialisation tasks)
> C:\WebApp1\work
> 
> 
> Question:
> 1. How should I configure Tomcat service so that it serves the WebApp1
> website?
> Which file in which folder to modify?
> 2. When Tomcat starts WebApp1 website, which set of configuration files
> is it
> using? (Those in C:\tomcat\conf\ or those in C:\WebApp1\conf\?)
> 3. If I am to add another website to the same server, say C:\WebApp2,
> with exact
> 
> 
> 
> folder structure as WebApp1, how should I configure Tomcat service so
> that it
> serves both WebApp1 and WebApp2?
> 4. The two sites will use different IP addresses. For example WebApp1
> is
> 43.88.12.123, and WebApp2 is 43.88.12.133. How do I tell Tomcat which
> IP belongs
> 
> 
> 
> to which website?
> 
> 
> Again, your input is very much appreciated.
> 
> Best regards
> Conway
> 
> ----- Original Message End ----
> 
> Note, I have not tried this, since I normally run multiple Tomcats
> using CATALINA_HOME and CATALINA_BASE. I'm basing this off the
> documentation found at:
> 
> http://tomcat.apache.org/tomcat-5.5-doc/index.html
> 
> AGAIN - CAVEAT - I have not tested this. I am not sure that there
> aren't a lot of typos (as well as other mistakes). Read the above
> documentation
> first, and then see if what I've written below makes sense.
> 
> Here's the overview:
> 
> 1. Create multiple <Service name="some-name"> under the <Server>
>    element.
> 
> 2. Create the desired connectors under each <Service name="some-name">
> 
> 3. The connectors should have an address="1.2.3.4" attribute for the
> desired IP
>    address.
> 
> 4. Create exactly one <Engine> element for each
>    <Service name="some-name">. If you are going to use clustering,
>    assign a UNIQUE name to the jvmroute="a-name" to each <Engine>
>    element.
> 
>    NOTE: Since you are defining multilple <Service> elements under a
>    single <Server> element, you MUST assign each <Engine> a unique
>    name with the name="b-name" attribute.
> 
> 5. Under the <Engine> name, create your desired <Host> element. For
>    the appBase attribute, give the absolute path where your web
>    applications will be stored.
> 
> Some notes on the above:
> 
> 1. The name="some-name" attribute of the <Service> element is used in
>    storing application-specific context.xml files
>    (application-name.xml).
> 
> Without looking at the code, I think you'll need to create
> subdirectories for each Service name (should I have said Engine name?)
> in
> %CATALINA_HOME%\conf. For example, if you created the following
> <Service>
> (<Engine name="Catalina2"> . . . </Engine> ??)elements:
> 
>    <Service name="Catalina2"> . . . . </Service>
>    <Service name="Catalina3"> . . . . </Service>
> 
> Then you would probably need to create the following directories:
> 
>    %CATALINA_HOME%\conf\Catalina2
>    %CATALINA_HOME%\conf\Catalina3
> 
> This is in addition to the default %CATALINA_HOME%\conf\Catalina
> directory.
> 
> 4. The name attribute of the <Engine> element will be used as part of
>    the log name for that particular <Service>.
> 
> So for the example above, you'll see the following in your
> %CATALINA_HOME%\logs directory (based on Linux - have not run this on
> Windows):
> 
>    catalina-[date].log
>    catalina.out
>    catalina2-[date].log
>    catalina2.out
>    catalina3-[date].log
>    catalina3.out
> 
> A unique defaultHost attribute is probably necessary due to logging.
> 
> 5. The <Host> element should have the same name attribute as the
>    defaultHost attribute of the corresponding <Engine> element.
> 
> Logs will show up in %CATALINA_HOME%\logs as (based on Linux - Windows
> may
> be different):
> 
>   localhost.[date].out
>   ahost.[date].out
>   bhost.[date].out
> 
> Manager Application:
> 
> If you are going to use the manager application, you'll need a copy
> for each host. Copy the existing:
> 
>    %CATALINA_HOME%\conf\Catalina\localhost\manager.xml
> 
> to each %CATALINA_HOME%\conf\[name]\[host-name]\manager.xml
> 
> where:
>    [name] is from the name attribute in your <Engine> element
>    [host-name] is from the name attribute in your <Host> element
> 
> In this configuration, the same tomcat-users.xml file which defines
> the manager application user name and passwords is used for all
> instances. This can be changed, but this email is long enough as it
> is.
> 
> Example
> 
> Please note that I have NOT tested this. I don't have a multi-homed
> server, and I run 6.0.x as a service in my Windows environment.
> 
> Following the instructions above, I come up with this server.xml file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Server port="8005" shutdown="SHUTDOWN">
> 
>   <!-- Comment these entries out to disable JMX MBeans
>        support used for the
>        administration web application -->
>   <Listener className="org.apache.catalina.core.AprLifecycleListener"
> />
>   <Listener
> className="org.apache.catalina.mbeans.ServerLifecycleListener" />
>   <Listener
> 
> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
> />
>   <Listener
> 
> className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener
> "/>
> 
>   <!-- Global JNDI resources -->
>   <GlobalNamingResources>
>     <!-- Editable user database that can also be used by
>          UserDatabaseRealm to authenticate users -->
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
> 
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
>   </GlobalNamingResources>
> 
>   <!-- Define the Tomcat Stand-Alone Services
>        This one is the default, modified slightly
>   -->
>   <Service name="Catalina">
>     <!-- Define a non-SSL HTTP/1.1 Connector on port 8080
>          Note the address attribute that is added
>     -->
>     <Connector port="8080" maxHttpHeaderSize="8192"
>                maxThreads="150" minSpareThreads="25"
> maxSpareThreads="75"
>                enableLookups="false" redirectPort="8443"
> acceptCount="100"
>                connectionTimeout="20000" disableUploadTimeout="true"
>                address="1.1.1.1"
>                URIEncoding="UTF-8"/>
>     <!-- this is for Tomcat - IIS connector, comment out if not used --
> >
>     <Connector port="8009"
>                address="1.1.1.1"
>                enableLookups="false" redirectPort="8443"
> protocol="AJP/1.3" />
>     <Engine name="Catalina" defaultHost="localhost">
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>       <!-- note the absolute path name for appBase -->
>       <Host name="localhost" appBase="C:\Webapps1"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false">
>       </Host>
>     </Engine>
>   </Service>
> 
>   <!-- Define the Tomcat Stand-Alone Services
>        This is another service. Unique name present in service
>   -->
>   <Service name="Catalina2">
>     <!-- Define a non-SSL HTTP/1.1 Connector on port 8080
>          Note a different address attribute is used
>          Note a different name is used and is unique
>     -->
>     <Connector port="8080" maxHttpHeaderSize="8192"
>                maxThreads="150" minSpareThreads="25"
> maxSpareThreads="75"
>                enableLookups="false" redirectPort="8443"
> acceptCount="100"
>                connectionTimeout="20000" disableUploadTimeout="true"
>                address="2.2.2.2"
>                URIEncoding="UTF-8"/>
>     <!-- this is for Tomcat - IIS connector, comment out if not used --
> >
>     <Connector port="8009"
>                address="2.2.2.2"
>                enableLookups="false" redirectPort="8443"
> protocol="AJP/1.3" />
>     <!-- Unique name present in Engine
>          Different default host name so log naming will be
> distinguishable
>     -->
>     <Engine name="Catalina2" defaultHost="Ahost">
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>       <!-- note the absolute path name for appBase -->
>       <Host name="Ahost" appBase="C:\Webapps2"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false">
>       </Host>
>     </Engine>
>   </Service>
> 
>   <!-- Define the Tomcat Stand-Alone Services
>        This is another service. Unique name present in service
>   -->
>   <Service name="Catalina3">
>     <!-- Define a non-SSL HTTP/1.1 Connector on port 8080
>          Note a different address attribute is used
>          Note a different name is used and is unique
>     -->
>     <Connector port="8080" maxHttpHeaderSize="8192"
>                maxThreads="150" minSpareThreads="25"
> maxSpareThreads="75"
>                enableLookups="false" redirectPort="8443"
> acceptCount="100"
>                connectionTimeout="20000" disableUploadTimeout="true"
>                address="3.3.3.3"
>                URIEncoding="UTF-8"/>
>     <!-- this is for Tomcat - IIS connector, comment out if not used --
> >
>     <Connector port="8009"
>                address="3.3.3.3"
>                enableLookups="false" redirectPort="8443"
> protocol="AJP/1.3" />
>     <!-- Unique name present in Engine
>          Different default host name so log naming will be
> distinguishable
>     -->
>     <Engine name="Catalina3" defaultHost="Bhost">
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>       <!-- note the absolute path name for appBase -->
>       <Host name="Bhost" appBase="C:\Webapps3"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false">
>       </Host>
>     </Engine>
>   </Service>
> 
> </Server>
> 
> The directory structure is shown below:
> 
> C:\Tomcat
> --- bin
> --- common
> --- conf
>     --- Catalina
>          --- localhost
>             --- manager.xml (file)
>     --- Catalina2
>          --- Ahost
>             --- manager.xml (file)
>     --- Catalina3
>          --- Bhost
>             --- manager.xml (file)
> --- logs
> --- server
> --- shared
> --- temp
> --- webapps (no longer used in the above configuration)
> --- work
> C:\Webapps1
> C:\Webapps2
> C:\Webapps3
> 
> . . . . just my two cents
> 
> 
> /mde/
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

__________________________________________________________________________

Confidentiality Notice:  This Transmission (including any attachments) may 
contain information that is privileged, confidential, and exempt from 
disclosure under applicable law.  If the reader of this message is not the 
intended recipient you are hereby notified that any dissemination, 
distribution, or copying of this communication is strictly prohibited.  

If you have received this transmission in error, please immediately reply to 
the sender or telephone (512) 343-9100 and delete this transmission from your 
system.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to