The easiest way to get the root context is to simply rename the application directory from webapps/site to webapps/ROOT and restart Tomcat. If your default webapps already has a ROOT application, you need to create another node, because there can only be one root context application per host.
Another option (again, if you do not already have a ROOT application under webapps ), you should edit your conf/server.xml file and add your context element to the default <Host> :
<Context path="" docBase="site" />
If you want to create a separate host, you will need to define the second <Host> in server.xml , for example,
<Host name="anotherhost" appBase="webapps_anotherhost"></Host>
To accomplish the above, you need to create the webapps_anotherhost folder as a sibling folder next to your main webapps folder and then leave the WAR in this folder either as an exploded directory named ROOT or a compressed WAR named ROOT.war . Then restart Tomcat and view the application at http://anotherhost:8080 (of course, you can also specify the file with the host files).
These are just a few of the many options. Tomcat docs describe this stuff in some detail. You can find documents for your version of Tomcat at http://tomcat.apache.org/ .
source share