Section 2 Windows installation tomcat

Table of Contents

1. Configure tomcat environment variables

1.1. Create new environment variables

1.2.Edit Path

2. Install tomcat-9.0.68

2.1.Tomcat official website download address

2.2.Usage of Tomcat

2.3.Tomcat starts automatically

3. Install and modify the configuration of Tomcat (the current tomcat-9.0.68 version has been modified and can be used directly)

3.1. Configure utf-8 encoding

3.2. Configure Tomcat to support include tags

3.3. Configure privileged=”true” in Tomcat’s conf/context.xml, otherwise some SSI features will not take effect.

3.4.Tomcat disables 3DES and DES algorithms:

4. Tomcat configures other path access (for disk expansion, directly pointing to the disk to store data)

5.tomcat request header is too large


1. Configure tomcat environment variables

1.1. Create a new environment variable

Variable name: CATALINA_HOME

Variable value: tomcat storage path

Variable name: CATALINA_BASE

Variable value: tomcat storage path

1.2.Edit Path

Put the following content at the end of the path

?TALINA_HOME%\lib;?TALINA_HOME%\bin;

2.Install tomcat-9.0.68

2.1.Tomcat official website download address

Apache Tomcat? – Welcome!

Select version

Select version

Select bin

Select the version corresponding to your computer system

2.2.Use of Tomcat

Unzip the tomcat compressed package and use it

2.3.Tomcat starts automatically

(1) Register tomcat to the service and cmd to the tomcat/bin directory

(2) Registration service command:

service.bat install tomact9.0.68

(3) Delete service command:

service.bat remove tomact9.0.68

3.Tomcat installation modification configuration (currently using tomcat-9.0.68 version, all have been modified It can be used directly)

3.1. Configure utf-8 encoding

Modify the conf/web.xml file

<init-param>
    <param-name>inputEncoding</param-name>
    <param-value>utf-8</param-value>
</init-param>
<init-param>
    <param-name>outputEncoding</param-name>
    <param-value>utf-8</param-value>
</init-param>

3.2. Configure Tomcat to support the include tag

 <servlet>
        <servlet-name>ssi</servlet-name>
        <servlet-class>
          org.apache.catalina.ssi.SSIServlet
        </servlet-class>
        <init-param>
          <param-name>buffered</param-name>
          <param-value>1</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>expires</param-name>
          <param-value>666</param-value>
        </init-param>
        <init-param>
          <param-name>isVirtualWebappRelative</param-name>
          <param-value>false</param-value>
        </init-param>

<init-param>
<param-name>inputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>outputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param>


        <load-on-startup>4</load-on-startup>

    </servlet>

 <servlet-mapping>
        <servlet-name>ssi</servlet-name>
        <url-pattern>*.shtml</url-pattern>
<url-pattern>*.html</url-pattern>
    </servlet-mapping>

3.3. Configure privileged= in Tomcat’s conf/context.xml “true”, otherwise some SSI features will not take effect.

<Context privileged="true">

3.4.Tomcat disables 3DES and DES algorithms:

Find the port configuration in tomcat/conf/server.xml, add Ciphers=””, add supported algorithms here, please do not add unsupported algorithms! as follows:

Ciphers="TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_ AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TL S_ECDHE_RSA_WITH_AES_256_CBC_SHA ,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"

Just restart Tomcat

4.tomcat configuration Other path access (for disk expansion, directly pointing to the disk to store data)

exist

5.tomcat request header is too large

server.xml originally did not configure maxHttpHeaderSize, the default value is only 4096 bytes (4k)

Modify tomcat request header length limit

Add: maxHttpHeaderSize=”500000″

<Connector connectionTimeout="20000"
           port="8080"
           protocol="HTTP/1.1"
           redirectPort="8443"
           maxHttpHeaderSize="500000"/>