Some instructions on host node configuration in tomcat's server. xml

  • 2020-05-10 23:16:24
  • OfStack

In fact, I didn't know much about this 1. Later, the company's website was integrated with IIS, and several applications needed to be configured. Therefore, I had a deep understanding of server.xml of tomcat

The node of Host mainly starts from 1 to the domain name resolution to the virtual host configuration, its name property is the domain name to access, the default is 127.0.0.1,localhost and local Ip, when the DNS specified, you can use the domain name to the specified virtual host access. I'm not going to talk too much about the 1's in there, but you can basically see what the word means.

Then is the context node, which is mainly configured to access the project in the virtual host, the default access project is context property path= "" project, a virtual host can not set two projects as path=" ", if so, tomcat will not start. path specifies the name of the project web at access time, while docBase specifies the physical path name.

  < Host name="localhost"   appBase="webapps"
                      unpackWARs="true" autoDeploy="true"
                      xmlValidation="false" xmlNamespaceAware="false" >
    < Context path="" docBase="web1" reloadable="true" crossContext="true" / >
              < !-- SingleSignOn valve, share authentication between web applications
                        Documentation at: /docs/config/valve.html -- >
              < !--
              < Valve className="org.apache.catalina.authenticator.SingleSignOn" / >
              -- >

              < !-- Access log processes all example.
                        Documentation at: /docs/config/valve.html -- >
              < !--
              < Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
                            prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/ >
              -- >

  < /Host >
 
  < Host name="paper" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false" >
    < Context path="web2" docBase="web2" reloadable="true" crossContext="true" / >
  < /Host >

Today the configuration parameter is written like this


 <Host name="test.ofstack.com" appBase="E:\webroot\jsp" uppackWARs="true" xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="E:\webroot" debug="0" reloadable="true"/>
 </Host>
</Host>

name: corresponds to the domain name of your project;
appBase: path to the virtual directory (the directory used to run jsp);
doBase: the top-level directory of the project is equivalent to the directory name in webapps, which is the root directory in iis.
Remember to copy your project to D:\webroot after configuration. My project is ecshoping

Notice the 1 has to be there < /Host > After or < host before adding.

Of course, you also need to modify the configuration of isapi_redirect

Specific can refer to this article: / / www ofstack. com article / 51924. htm


Related articles: