1

i am using tomcat. i have a folder with my website in it called exampleSite

when i go to my website www.example.com i would like the index.html inside exampleSite to load up and not the IndexFile within ROOT.

How would i go about achieving this?

molleman
  • 2,934
  • 16
  • 61
  • 92
  • http://stackoverflow.com/questions/715506/tomcat-6-how-to-change-the-root-application/6093662#6093662 –  May 29 '12 at 09:49

1 Answers1

0

There are two ways of deploying a web application on the filesystem:

  1. Copy your WAR file or your web application's directory (including all of its content) to the $CATALINA_BASE/webapps directory.

  2. Create an XML fragment file with just the Context element for your web application, and place this XML file in $CATALINA_BASE/webapps. The web application itself can then be stored anywhere on your filesystem.

Another way to deploy a web app is by writing a Context XML fragment file and deploying it into the CATALINA_BASE/webapps directory. A context fragment is not a complete XML document, but just one Context element and any subelements that are appropriate for your web application. These files are like Context elements cut out of the server.xml file, hence the name "context fragment."

For example, if we wanted to deploy the WAR file MyWebApp.war along with a realm for accessing parts of that web application, we could use this fragment:

<!--  
  Context fragment for deploying MyWebApp.war  
 -->
<Context path="/demo" docBase="webapps/MyWebApp.war" 
         debug="0" privileged="true">
  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"                
         resourceName="UserDatabase"/> 
</Context>

Put that in a file called "MyWebApp.xml," and copy it into your CATALINA_BASE/webapps directory.

These context fragments provide a convenient method of deploying web applications; you do not need to edit the server.xml file and, unless you have turned off the default liveDeploy feature, you don't have to restart Tomcat to install a new web application.

Reference

jmj
  • 237,923
  • 42
  • 401
  • 438