tomcat deployment project, start only once

Problems encountered so far: The desktop version, Android version, and iOS version have been completed. They are all interfaces for adjusting the background. The path has been written, and modification is not allowed. (People are gone~~~~~~~~~~~~)

Requirements: Enter the domain name to directly access the official website of the project. And the project access must have the project name.

**************** The most important thing is that there are scheduled tasks in my project to request the data of the third-party interface. It is necessary to prevent tomcat from starting twice to avoid data confusion. ****************

Two ways to try it yourself:

There is no project (myApp) under the following two webapps, and a location is created on the d disk to store it.

The first:

The configuration is as follows:

<Host name="www.****.com"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Context path="/" docBase ="D:\cc\myApp"/>
      </Host>

In this case, entering the domain name can directly access the official website, but the ip access project with the project name cannot be accessed.

The second:

The configuration is as follows:

<Host name="www.****.com"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
        <Context path="/myApp" docBase ="D:\cc\myApp"/>
      </Host>

The situation encountered in this situation is that the official website cannot be accessed directly by entering the domain name, but the item ip access item with the item name can be accessed directly.

The method I want is a compromise between the above two methods. You can directly access the project through the domain name, and you can access the project with the project name through ip. Do not know if it can be achieved? ? ?

In the end, the problem was solved, and I went to IIS to make some changes to the domain name.

The changes are as follows, in which an index, html page is set


Write a jump in the page, as shown below


After configuration, restart tomcat, the domain name access project is ok, and the path of ip plus project name access is ok.

Item was successfully accessed. . . .

Personal configuration uses the second one. . . . . . Now that it's okay, okay, okay, okay.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325738034&siteId=291194637