Tomcat - How to set web application context path as server root
- Details
- Written by Nam Ha Minh
- Last Updated on 06 August 2019   |   Print Email
http://hostname:port/WebAppName/Here, the context root of the server is hostname, and the context path of the web applicaton is WebAppName.However, in practice we may want to use only the server's host name to access the web application, via this kind of URL:
http://hostname:port/In this case the context path of the web application is united with the server root - it would be very convenient for many cases. So, how to setup Tomcat server to change the default?The simplest way is to deploy your Java web application as ROOT.war under the webapps directory. Follow these steps:- Rename your web application's WAR file to ROOT.war
NOTES:You can still access Tomcat manager application with the context path /manager.Apply the same steps in case you use virtual host with different base directory.
Other Tomcat Tutorials:
- How to deploy a Java web application on Tomcat
- How to Embed Tomcat Server into Java Web Applications
- How to Use Virtual Hosts in Tomcat
- How to configure JNDI DataSource for Database Connection Pooling in Tomcat
- How to configure session timeout in Tomcat
- How to change Tomcat port number
- How to add Tomcat server in Eclipse
- How to change server location and deploy path for Tomcat in Eclipse
Comments