Tomcat website publishing configuration scheme detailed description

Time:2021-4-10

Modify the port, modify the default publishing directory, multi domain name binding

1、 Modify the publishing port number to 80 (Tomcat defaults to 8080)
 
Open the configuration file (my name is as follows: e:: (J2EE server) Tomcat 6.0.conf\ server.xml ), find:

Copy codeThe code is as follows:
<Connector port=”8080″ protocol=”HTTP/1.1″ 

              maxThreads=”150″ connectionTimeout=”20000″  

              redirectPort=”8443″ />   
<Connector port=”8080″ protocol=”HTTP/1.1″

             maxThreads=”150″ connectionTimeout=”20000″

             redirectPort=”8443″ />

After modification:

Copy codeThe code is as follows:
<Connector port=”80″ protocol=”HTTP/1.1″  

              maxThreads=”150″ connectionTimeout=”20000″  

              redirectPort=”8443″ />  
<Connector port=”80″ protocol=”HTTP/1.1″

             maxThreads=”150″ connectionTimeout=”20000″

             redirectPort=”8443″ />

In fact, this is the port:8080 , amend to port:80 That’s it. The other parameters don’t change. In this way, the client can directly enter IP or domain name when accessing the server.

2、 Modifying the character set of Tomcat
 
Everyone should have encountered the problem of Chinese garbled code in the process of writing the program. In addition to ensuring the consistency of the character set of the page and database, there is another point to note, that is, the character set of tamcat. Sometimes from the beginning to the end of the inspection program, found that everything is normal, but there is garbled, look at the Tomcat character set it! Find e: Tomcat 6.0\ server.xml :

Copy codeThe code is as follows:
<Connector port=”80″ protocol=”HTTP/1.1″  

              maxThreads=”150″ connectionTimeout=”20000″  

              redirectPort=”8443″ />  
<Connector port=”80″ protocol=”HTTP/1.1″

             maxThreads=”150″ connectionTimeout=”20000″

             redirectPort=”8443″ />

After modification:

Copy codeThe code is as follows:
<Connector port=”80″ protocol=”HTTP/1.1″  

              maxThreads=”150″ connectionTimeout=”20000″   

              redirectPort=”8443″ URIEncoding=”UTF-8″/>  
<Connector port=”80″ protocol=”HTTP/1.1″

             maxThreads=”150″ connectionTimeout=”20000″

             redirectPort=”8443″ URIEncoding=”UTF-8″/>

3、 Modify the Tomcat publishing path (default path: e: / / J2EE server / Tomcat 6.0 / webapps / root)
Open the configuration file (my name is in: e::? J2EE server? Tomcat 6.0? CONF)\ server.xml ), find:

Copy codeThe code is as follows:
<Engine name=”Catalina” defaultHost=”localhost”>   

<Host name=”localhost”   appBase=”webapps”  

             unpackWARs=”true”  

             xmlValidation=”false” xmlNamespaceAware=”false”>         

</Host>   

</Engine>  
<Engine name=”Catalina” defaultHost=”localhost”>

<Host name=”localhost”  appBase=”webapps”

            unpackWARs=”true”

            xmlValidation=”false” xmlNamespaceAware=”false”>     

</Host>

</Engine>

Add between < host > < / host > Tags:

Copy codeThe code is as follows:
<Context path=”” docBase=”photo” debug=”0″ reloadable=”true” />  
< context path = “docbase =” project path “debug =” 0 “reloadable =” true “/ >

Path is the name of the virtual directory. If you want to display the home page only by entering the IP address, the key value will be left blank;

Docbase is the path of the virtual directory, and its default is the $Tomcat / webapps / root directory. Now I have created a photo directory under the webapps directory, and let this directory be my default directory. Debug and reloadable are generally set to 0 and true respectively.

In this way, when you visit the server again, you will find the page under $Tomcat / webapps / photo

 

3、 Multi domain name binding
 
Open the configuration file (my name is as follows: D:: program files, Tomcat, CONF)\ server.xml ), find:

Copy codeThe code is as follows:
<Engine name=”Catalina” defaultHost=”localhost”>   

<Host name=”localhost”   appBase=”webapps”  

             unpackWARs=”true”  

             xmlValidation=”false” xmlNamespaceAware=”false”>         

     </Host>   

</Engine>  
<Engine name=”Catalina” defaultHost=”localhost”>

<Host name=”localhost”  appBase=”webapps”

            unpackWARs=”true”

            xmlValidation=”false” xmlNamespaceAware=”false”>     

    </Host>

</Engine>

Scheme 1: multiple projects in different directories

Copy codeThe code is as follows:
<Engine name=”Catalina” defaultHost=”pic.jb51.net”>   

     <Realm className=”org.apache.catalina.realm.UserDatabaseRealm”  

              resourceName=”UserDatabase”/>   

  

     <Host name=”xixi.jb51.net”   appBase=”abcapps”  

             unpackWARs=”true”  

             xmlValidation=”false” xmlNamespaceAware=”false”>   

</Host>  
<Engine name=”Catalina” defaultHost=”pic.jb51.net”>

    <Realm className=”org.apache.catalina.realm.UserDatabaseRealm”

             resourceName=”UserDatabase”/>

 

    <Host name=”xixi.jb51.net”  appBase=”abcapps”

            unpackWARs=”true”

            xmlValidation=”false” xmlNamespaceAware=”false”>

</Host>

 
     <Host name=”haha.jb51.net”   appBase=”D:\Program Files\Tomcat\test”  

             unpackWARs=”true”  

             xmlValidation=”false” xmlNamespaceAware=”false”>   

</Host>   

  

     <Host name=”lala.jb51.net”   appBase=”webapps”  

             unpackWARs=”true”  

             xmlValidation=”false” xmlNamespaceAware=”false”>   

     </Host>   

</Engine>  
<Host name=”haha.jb51.net”  appBase=”D:\Program Files\Tomcat\test”

            unpackWARs=”true”

            xmlValidation=”false” xmlNamespaceAware=”false”>

</Host>

 

    <Host name=”lala.jb51.net”  appBase=”webapps”

            unpackWARs=”true”

            xmlValidation=”false” xmlNamespaceAware=”false”>

    </Host>

</Engine>

Add the following contents to the hosts file under C: (windows, system32, drivers, etc.):

127.0.0.1 xixi.jb51.net

127.0.0.1 lala.jb51.net

127.0.0.1 haha.jb51.net

According to the above configuration:

one http://xixi.jb51.net Visit the website under ${Tomcat} abcaps / root

two http://haha.jb51.net Visit the website under D: program files, Tomcat, test and root

three http://lala.jb51.net Visit the website under ${Tomcat} webapps / root

Dafaulthost of engine: the default host to access the Tomcat. Note that it must not be localhost, otherwise others will enter the Tomcat management interface by default when accessing through your IP

Host name: indicates the domain name bound to the host. If the host is bound to localhost, you can access the host by entering localhost in the browser

Appbase of host: the file storage path bound by the host. Relative path or absolute path can be used

 
Scheme 2: multiple projects are in the same directory webapps, that is, in different < host > < / host > with < context >

Copy codeThe code is as follows:
<Engine name=”Catalina” defaultHost=”xixi.jb51.net”>   

     <Realm className=”org.apache.catalina.realm.UserDatabaseRealm”  

         resourceName=”UserDatabase”/>   

  

     <Host name=”xixi.jb51.net”   appBase=”webapps”  

         unpackWARs=”true”  

         xmlValidation=”false” xmlNamespaceAware=”false”>   

        <Context path=”” docBase=”test1″ debug=”0″ reloadable=”true” />   

</Host>   

  

<Host name=”haha.jb51.net”   appBase=”webapps”  

         unpackWARs=”true”  

         xmlValidation=”false” xmlNamespaceAware=”false”>   

        <Context path=”” docBase=”test2″ debug=”0″ reloadable=”true” />   

</Host>   

  

<Host name=”lala.jb51.net”   appBase=”webapps”  

         unpackWARs=”true”  

         xmlValidation=”false” xmlNamespaceAware=”false”>   

        <Context path=”” docBase=”test3″ debug=”0″ reloadable=”true” />   

</Host>

Recommended Today

Proj2 of TinySQL learning notes

This paper mainly introduces the implementation of TinySQLproj2The specific ideas and implementation of the system File TinySQL / parser / parser. Y: 3806 JoinTable: /* Use %prec to evaluate production TableRef before cross join */ TableRef CrossOpt TableRef %prec tableRefPriority { $$ = &ast.Join{Left: $1.(ast.ResultSetNode), Right: $3.(ast.ResultSetNode), Tp: ast.CrossJoin} } /* Your code here. */ […]