Mongoosej.Blog.Software.Application Software.Web Container.Tomcat


User Guide

Dir

TomCat\conf\server.xml

  1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. --><!-- Note: A "Server" is not itself a "Container", so you may not
  16. define subcomponents such as "Valves" at this level.
  17. Documentation at /docs/config/server.html
  18. -->
  19. <Server port="8005" shutdown="SHUTDOWN">
  20. <Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
  21. <!-- Security listener. Documentation at /docs/config/listeners.html
  22. <Listener className="org.apache.catalina.security.SecurityListener" />
  23. -->
  24. <!--APR library loader. Documentation at /docs/apr.html -->
  25. <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
  26. <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  27. <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
  28. <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  29. <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
  30. <!-- Global JNDI resources
  31. Documentation at /docs/jndi-resources-howto.html
  32. -->
  33. <GlobalNamingResources>
  34. <!-- Editable user database that can also be used by
  35. UserDatabaseRealm to authenticate users
  36. -->
  37. <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
  38. </GlobalNamingResources>
  39. <!-- A "Service" is a collection of one or more "Connectors" that share
  40. a single "Container" Note: A "Service" is not itself a "Container",
  41. so you may not define subcomponents such as "Valves" at this level.
  42. Documentation at /docs/config/service.html
  43. -->
  44. <Service name="Catalina">
  45. <!--The connectors can use a shared executor, you can define one or more named thread pools-->
  46. <!--
  47. <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
  48. maxThreads="150" minSpareThreads="4"/>
  49. -->
  50. <!-- A "Connector" represents an endpoint by which requests are received
  51. and responses are returned. Documentation at :
  52. Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
  53. Java AJP Connector: /docs/config/ajp.html
  54. APR (HTTP/AJP) Connector: /docs/apr.html
  55. Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
  56. -->
  57. <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
  58. <!-- A "Connector" using the shared thread pool-->
  59. <!--
  60. <Connector executor="tomcatThreadPool"
  61. port="8080" protocol="HTTP/1.1"
  62. connectionTimeout="20000"
  63. redirectPort="8443" />
  64. -->
  65. <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
  66. This connector uses the NIO implementation that requires the JSSE
  67. style configuration. When using the APR/native implementation, the
  68. OpenSSL style configuration is required as described in the APR/native
  69. documentation -->
  70. <!--
  71. <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
  72. maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
  73. clientAuth="false" sslProtocol="TLS" />
  74. -->
  75. <!-- Define an AJP 1.3 Connector on port 8009 -->
  76. <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
  77. <!-- An Engine represents the entry point (within Catalina) that processes
  78. every request. The Engine implementation for Tomcat stand alone
  79. analyzes the HTTP headers included with the request, and passes them
  80. on to the appropriate Host (virtual host).
  81. Documentation at /docs/config/engine.html -->
  82. <!-- You should set jvmRoute to support load-balancing via AJP ie :
  83. <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
  84. -->
  85. <Engine defaultHost="localhost" name="Catalina">
  86. <!--For clustering, please take a look at documentation at:
  87. /docs/cluster-howto.html (simple how to)
  88. /docs/config/cluster.html (reference documentation) -->
  89. <!--
  90. <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
  91. -->
  92. <!-- Use the LockOutRealm to prevent attempts to guess user passwords
  93. via a brute-force attack -->
  94. <Realm className="org.apache.catalina.realm.LockOutRealm">
  95. <!-- This Realm uses the UserDatabase configured in the global JNDI
  96. resources under the key "UserDatabase". Any edits
  97. that are performed against this UserDatabase are immediately
  98. available for use by the Realm. -->
  99. <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
  100. </Realm>
  101. <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
  102. <!-- SingleSignOn valve, share authentication between web applications
  103. Documentation at: /docs/config/valve.html -->
  104. <!--
  105. <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
  106. -->
  107. <!-- Access log processes all example.
  108. Documentation at: /docs/config/valve.html
  109. Note: The pattern used is equivalent to using pattern="common" -->
  110. <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>
  111. </Host>
  112. </Engine>
  113. </Service>
  114. </Server>
  • <Server port="8005" shutdown="SHUTDOWN">,配置这个端口的作用是用来发送关闭Tomcat的命令。在Tomcat启动的情况下,使用telnet命令连接此端口,在连接成功后,发送配置的”SHUTDOWN“字符串,可以关闭Tomcat服务。但是Tomcat考虑到安全性,此端口命令必须在Tomcat服务所在的本机上使用,远程发送是无效的。

    FAQ

    优化类