Tomcat server.xml Optimization

Source: Internet
Author: User
Tags documentation server port tomcat server
<?xml version= ' 1.0 ' encoding= ' utf-8 '?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
Contributor license agreements. The NOTICE file distributed with
This is work for additional information regarding copyright ownership.
The ASF licenses this file to your under the Apache License, Version 2.0
(the "License"); You are not to use this file except in compliance with
The License. You could obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable or agreed to in writing, software
Distributed under the License is distributed on ' as is ' basis,
Without warranties or CONDITIONS of any KIND, either express or implied.
The License for the specific language governing permissions and
Limitations under the License.
-->
<!--note:a "Server" is not itself A "Container"
Define subcomponents such as "valves" at the level.
Documentation at/docs/config/server.html
-->
<server port= "8005" shutdown= "Shutdown" >
<listener classname= "Org.apache.catalina.startup.VersionLoggerListener"/>
<!--security listener. Documentation at/docs/config/listeners.html
<listener classname= "Org.apache.catalina.security.SecurityListener"/>
-->
<!--APR Library loader. Documentation At/docs/apr.html-->
<listener classname= "Org.apache.catalina.core.AprLifecycleListener" sslengine= "on"/>
<!--Initialize Jasper prior to WebApps are loaded. Documentation At/docs/jasper-howto.html-->
<listener classname= "Org.apache.catalina.core.JasperListener"/>
<!--prevent memory leaks due to use particular Java/javax
<listener classname= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<listener classname= "Org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<listener classname= "Org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

<!--Global JNDI Resources
Documentation at/docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!--Editable User database that can also is used by
Userdatabaserealm to authenticate users
-->
<resource name= "Userdatabase" auth= "Container"
Type= "Org.apache.catalina.UserDatabase"
description= "User database" can be updated and saved "
factory= "Org.apache.catalina.users.MemoryUserDatabaseFactory"
Pathname= "Conf/tomcat-users.xml"/>
</GlobalNamingResources>

<!--a ' Service ' is a collection of one or more ' connectors ' that share
A single "Container" Note:a "Service" are not itself a "Container",
So, May is not define subcomponents such as "valves" at the level.
Documentation at/docs/config/service.html
-->
<service name= "Catalina" >

<!--the connectors can use a shared executor, can define one or more named thread pools-->
<!--
<executor name= "Tomcatthreadpool" nameprefix= "catalina-exec-"
maxthreads= "minsparethreads=" "4"/>
-->


<!--A "Connector" represents A endpoint by which requests are received
and responses are returned. Documentation at:
Java HTTP Connector:/docs/config/http.html (Blocking & non-blocking)
Java AJP Connector:/docs/config/ajp.html
APR (HTTP/AJP) Connector:/docs/apr.html
Define a Non-ssl http/1.1 Connector on port 8080
-->
<connector executor= "Tomcatthreadpool" port= "8080" protocol= "Org.apache.coyote.http11.Http11AprProtocol" Enablelookups= "false" maxthreads= "acceptcount=" acceptorthreadcount= "2" connectiontimeout= "6000" Redirectport= "8443" compression= "on" maxkeepaliverequests= "1"/>

<!--<connector port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443"/>-->
<!--A "Connector" using the shared thread pool-->
<!--
<connector executor= "Tomcatthreadpool"
port= "8080" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/>
-->
<!--Define a SSL http/1.1 Connector on port 8443
This is connector uses the BIO implementation that requires the JSSE
Style configuration. When using the apr/native implementation, the
OpenSSL style configuration is required as described in the apr/native
Documentation-->
<!--
<connector port= "8443" protocol= "Org.apache.coyote.http11.Http11Protocol"
maxthreads= "sslenabled=" "true" Scheme= "https" secure= "true"
Clientauth= "false" sslprotocol= "TLS"/>
-->

<!--Define a AJP 1.3 Connector on port 8009
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>-->


<!--an Engine represents "entry point" (within Catalina) that processes
Every request. The Engine implementation for Tomcat stand alone
Analyzes the HTTP headers included with the request, and passes them
On to the appropriate host (virtual Host).
Documentation At/docs/config/engine.html-->

<!--should set Jvmroute to support load-balancing via AJP ie:
<engine name= "Catalina" defaulthost= "localhost" jvmroute= "jvm1" >
-->
<engine name= "Catalina" defaulthost= "localhost" >

<!--for clustering, take a look at documentation at:
/docs/cluster-howto.html (Simple to)
/docs/config/cluster.html (reference documentation)-->
<!--
<cluster classname= "Org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->

<!--use the Lockoutrealm to prevent attempts to guess user passwords
Via a brute-force attack-->
<realm classname= "Org.apache.catalina.realm.LockOutRealm" >
<!--This Realm uses the userdatabase configured in the global JNDI
Resources under the key "Userdatabase". Any edits
That's are performed against this userdatabase are immediately
Available for use by the Realm. -->
<realm classname= "Org.apache.catalina.realm.UserDatabaseRealm"
Resourcename= "Userdatabase"/>
</Realm>

Unpackwars= "true" autodeploy= "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
Note:the pattern used are equivalent to using pattern= "common"-->
<!--<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 "/>-->
<!--<valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "${user.home}/logs"
Prefix= "Ip.access.log." suffix= "" buffered= "false"
Pattern= "&quot;%{X-Forwarded-For}i&quot; &quot;%{CLIENT_IP}i&quot; %t%t%m &quot;%U&quot; &quot;%q&quot; %s%b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; "/>-->

</Host>
</Engine>
</Service>
</Server>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.