How to use Tomcat to perfectly access a web project without configuring the "project name"

Renderings

The original www.feng.com:8080/oa/to_login is now www.feng.com:8080/to_login

Many people know that configuring server.xml, but you missed a critical step.

When Tomcat starts, it will go to the application in the default ROOT directory under webapps, which leads to the reason why you ca n’t always access

Remember, remember, this is the key, violent solution

First delete the original ROOT it has

Change your project package "oa.war" to "ROOT.war" , because the uppackWARS in the following server.xml will automatically decompress the war package into a ROOT file, so that ROOT will be regenerated. It is useless to delete Root. At this time , the docBase setting in server.xml should be set to "ROOT" . It becomes the following picture! ! !

Open tomcat--> conf--> server.xml edit

 <Host name="www.feng.com"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
      <Context path="" docBase="ROOT" reloadable="true" privileged="true" />

I believe most people are doing the following operations, which is why it can't run.

The key is that the docBase project should be rooted

When Tomcat starts, it will go to webapps to access the applications in the default ROOT directory

So suppose your project name is " oa.war ", but docBase = "oa" is useless, because the original ROOT file will be automatically called when tomcat is opened, and the effect is still that tomcat "classic little tiger".

Now it started successfully

Restart tomcat

The original website www.feng.com:8080/oa/to_login is now www.feng.com:8080/to_login , running successfully

Guess you like

Origin www.cnblogs.com/dearroy/p/12691581.html
Recommended