Tomcat相关配置


1、catalina.sh  配置JVM参数

# $Id: catalina.sh 1498485 2013-07-01 14:37:43Z markt $
# -----------------------------------------------------------------------------

JAVA_OPTS='-server -Xmx3g -Xms3g -Xmn1g -XX:PermSize=128m -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70'

# OS specific support.  $var _must_ be set to either true or false.


2、server.xml 参数优化

<Connector address="192.168.8.101" port="9080" protocol="HTTP/1.1"
               maxHttpHeaderSize="8192"
               URIEncoding="UTF-8"
               maxThreads="768"
               acceptCount="1000"
               minSpareThreads="50"
               maxSpareThreads="75"
               enableLookups="false"
               connectionTimeout="20000"
               redirectPort="8443" />
<!--
      <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxHttpHeaderSize="8192"
               connectionTimeout="10000"
               URIEncoding="UTF-8"
               enableLookups="false"
               SSLEnabled="true"
               minSpareThreads="30"
               maxThreads="768"
               acceptCount="1000"
               scheme="https" secure="true"
               keystoreFile="/usr/local/ssl/keystore.jks"
               keystorePass="oVk5QcndnA#m"
               clientAuth="false" sslProtocol="TLS"   sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2"
            ciphers="TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_3DES_EDE_CBC_SHA"       
    />
-->



3、项目配置

server.xml

 
<Host name="manage.iccmccloud.com"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
    <Context path="" docBase="/usr/local/SpringManage"/>

</Host>

可以配置多个:

<Host name="a.bbb.com"  appBase="webapps" unpackWARs="true" autoDeploy="true">
		 <Context path="" docBase="/usr/local/WebA" />
    <!--配置多个域名-->
    <alias>b.bbb.com</alias>
    <alias>c.bbb.com</alias>
		 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
			   prefix="git_access_log" suffix=".txt"
			   pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>


<Host name="b.bbb.com"  appBase="webapps"  unpackWARs="true" autoDeploy="true">
		<Context path="" docBase="/usr/local/WebB" />
	   
		<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
				prefix="manage_access_log" suffix=".txt"
				pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>



4、配置图片访问路径

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

	<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
		   prefix="localhost_access_log" suffix=".txt"
		   pattern="%h %l %u %t &quot;%r&quot; %s %b" />
		   
	<Context path="pic" docBase="D:\\pic" />   

  </Host>

所有图片放在d:\\pic里面,图片访问路径为:http://localhost:8080/pic/abc1.png




tomcat tomcat性能优化 项目配置

2020.11.18 21:12

https://www.meihaocloud.com.com/162.html , 欢迎转载,请在文章页标出原文连接 !


Copyright © 2020 千夕网 联系站长

粤公网安备 44030302001408号 粤ICP备19099833号-1