Tomcat 安装与配置规范

Tomcat 安装

演示版本:8.5.32 安装版

下载地址:https://tomcat.apache.org/download-80.cgi

安装教程

 修改server.xml

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="500" minSpareThreads="20" maxSpareThreads="50" maxIdleTime="600"/>

     <Connector executor="tomcatThreadPool"
               port="80" protocol="org.apache.coyote.http11.Http11NioProtocol"
               URIEncoding="UTF-8"
               connectionTimeout="30000"
               enableLookups="false"
               disableUploadTimeout="false"
               connectionUploadTimeout="150000"
               acceptCount="300"
               keepAliveTimeout="120000"
               maxKeepAliveRequests="1"
               compression="on"
               compressionMinSize="2048"
               compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,image/gif,image/jpg,image/png" 
               redirectPort="8443" />

增加全局错误页面处理

准备一个错误处理页面error.html(内容自定义)

把error.html放到\webapps\ROOT目录下

修改web.xml增加下图代码

<error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/error.html</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/error.html</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/error.html</location>
    </error-page>

增加tomcatq启动内存

猜你喜欢

转载自www.cnblogs.com/klslb/p/9272776.html