1. Access to applications under webapps of tomcat9

A paragraph needs to be added under <Host> in the server.xml file of tomcat9:

 <Context docBase="/xxx/tomcat9/webapps/xxx" path="/" reloadable="true"></Context>

After the change is roughly:

 <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
            
            <Context docBase="/xxx/tomcat9/webapps/xxx" path="/" reloadable="true"></Context>

Notice:

  • path="/" means, it is equivalent to specifying this application as the default access method of ROOT --> root directory access
  • localhost can be changed to a specific domain name, such as www.niewj.com , depending on your domain name

2. Further: delete all directories under webapps, leaving only your own applications

2.1 Delete Instructions

  • The folders docs, examples and ROOT can be deleted directly;
  • After host-manager and manager are deleted, there will be log alarms. To eliminate them, you need to do the following:

2.2 What needs to be deleted

tomcat/conf/logging.properties Delete some configuration:

  • [1] handlers delete two items:

     3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler,
  • [2] The following two related items are also deleted (note them out):

     # 3manager.org.apache.juli.AsyncFileHandler.level = FINE
    # 3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
    # 3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
    # 3manager.org.apache.juli.AsyncFileHandler.maxDays = 90
    # 3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8
    
    
    # 4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
    # 4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
    # 4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
    # 4host-manager.org.apache.juli.AsyncFileHandler.maxDays = 90
    # 4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

    3. Summary

    Then, delete everything under webapps, and only keep the applications related to your own business, and with the first point, direct localhost:8080/ access is your own application.


Reference: https://blog.csdn.net/flyingaga/article/details/63691634


丰木
322 声望19 粉丝

遇见超乎想象的自己!