Linux – Tomcat6 -> How do I put a project in the root folder?

Tomcat6 -> How do I put a project in the root folder?… here is a solution to the problem.

Tomcat6 -> How do I put a project in the root folder?

I have a Tomcat6 server on a Linux server. The structure of the webapps directory is:

  • Example
  • Host manager
  • Manager
  • Root directory
  • Samples

I have a web application running on localhost on Tomcat. I created a war file, MyProject.war, and put it in the webapps directory. Restart the Tomcat server, war is extracted and I have this structure:

  • Example
  • Host manager
  • Manager
  • My project
  • Root directory
  • Samples

Call URL http://mysubdomain.mysite.com:8080/ I get the Tomcat start page

If you’re seeing this page with a web browser, it means you’ve setup Tomcat successfully. Congratulations!.

Call http://mysubdomain.mysite.com:8080/MyProject/ I get the page of my project.

What I want is that I can access my project using a URL http://mysubdomain.mysite.com:8080/ instead of a http://mysubdomain.mysite. com:8080/MyProject/

What should I do?

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 used an empty string on the path and/or restarted Tomcat. Neither works. The home directory shows me the Tomcat start page instead of my project. The project can only be done through … : 8080/MyProject/ Access

Solution

Delete the ROOT folder, rename MyProject.war to ROOT.war, and reboot.

You can also do this by adding the following line in <Host> by entering /conf/server.xml

<Context docBase="MyProject" path="" />

Related Problems and Solutions