I have a Tomcat6 server on a Linux server. The structure of the webapps directory is:
- examples
- host-manager
- manager
- ROOT
- sample
I have a web application running on my localhost on a Tomcat. I created a war file MyProject.war and put it into the webapps directory. Restarting the Tomcat server, the war is extracted and I have this structure:
- examples
- host-manager
- manager
- MyProject
- ROOT
- sample
Calling the URL http://mysubdomain.mysite.com:8080/ I get the Tomcat start page with
If you're seeing this page with a web browser, it means you've setup Tomcat successfully. Congratulations!.
Calling http://mysubdomain.mysite.com:8080/MyProject/ I get the page of my project.
What I want, is that I can access my project with the URL http://mysubdomain.mysite.com:8080/ and not with http://mysubdomain.mysite.com:8080/MyProject/
How can I do this?
Best Regards.
Update I have this in my server.xml:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="MyProject" path="/" />
</Host>
I did it on path with an empty string and / and restart Tomcat. Both does not work. The main directory shows me the Tomcat start page instead of my project. The project is only reachable with ...:8080/MyProject/
Delete ROOT folder, rename MyProject.war to ROOT.war and restart.
You can also do it by adding the following line to inside the <Host> entry of /conf/server.xml
<Context docBase="MyProject" path="" />
来源:https://stackoverflow.com/questions/4707583/tomcat6-how-to-put-a-project-into-the-root-folder