Topic Text   Topic Comments (4)   Topic Properties   Topic Information oliver.toense@fri...
Topic title: tomcat config Wednesday January 14, 2009 09:30:45

Download topic text | View in monospace font | Tab width set to 4 (change to 8)

Files in topic:  
[Jump to] server.xml   {+368,-0}

[Add General Comment] to topic.

File server.xml (Revision 1.0) [Add File Comment] [Top]
 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Example Server Configuration File --><!-- Note that component elements are nested corresponding to their
3 parent-child relationships with each other --><!-- A "Server" is a singleton element that represents the entire JVM,
4 which may contain one or more "Service" instances. The Server
5 listens for a shutdown command on the indicated port.
6
7 Note: A "Server" is not itself a "Container", so you may not
8 define subcomponents such as "Valves" or "Loggers" at this level.
9 --><Server port="8005" shutdown="SHUTDOWN">
10
11 <!-- Comment these entries out to disable JMX MBeans support used for the
12 administration web application -->
13 <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
14 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
15 <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
16 <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
17
18 <!-- Global JNDI resources -->
19 <GlobalNamingResources>
20
21 <!-- Test entry for demonstration purposes -->
22 <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
23
24 <!-- Editable user database that can also be used by
25 UserDatabaseRealm to authenticate users -->
26 <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"/>
27
28 </GlobalNamingResources>
29
30 <!-- A "Service" is a collection of one or more "Connectors" that share
31 a single "Container" (and therefore the web applications visible
32 within that Container). Normally, that Container is an "Engine",
33 but this is not required.
34
35 Note: A "Service" is not itself a "Container", so you may not
36 define subcomponents such as "Valves" or "Loggers" at this level.
37 -->
38
39 <!-- Define the Tomcat Stand-Alone Service -->
40 <Service name="Catalina">
41
42 <!-- A "Connector" represents an endpoint by which requests are received
43 and responses are returned. Each Connector passes requests on to the
44 associated "Container" (normally an Engine) for processing.
45
46 By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
47 You can also enable an SSL HTTP/1.1 Connector on port 8443 by
48 following the instructions below and uncommenting the second Connector
49 entry. SSL support requires the following steps (see the SSL Config
50 HOWTO in the Tomcat 5 documentation bundle for more detailed
51 instructions):
52 * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
53 later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
54 * Execute:
55 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
56 $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
57 with a password value of "changeit" for both the certificate and
58 the keystore itself.
59
60 By default, DNS lookups are enabled when a web application calls
61 request.getRemoteHost(). This can have an adverse impact on
62 performance, so you can disable it by setting the
63 "enableLookups" attribute to "false". When DNS lookups are disabled,
64 request.getRemoteHost() will return the String version of the
65 IP address of the remote client.
66 -->
67
68 <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
69 <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="8080" redirectPort="8443"/>
70 <!-- Note : To disable connection timeouts, set connectionTimeout value
71 to 0 -->
72
73 <!-- Note : To use gzip compression you could set the following properties :
74
75 compression="on"
76 compressionMinSize="2048"
77 noCompressionUserAgents="gozilla, traviata"
78 compressableMimeType="text/html,text/xml"
79 -->
80
81 <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
82 <!--
83 <Connector port="8443" maxHttpHeaderSize="8192"
84 maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
85 enableLookups="false" disableUploadTimeout="true"
86 acceptCount="100" scheme="https" secure="true"
87 clientAuth="false" sslProtocol="TLS" />
88 -->
89
90 <!-- Define an AJP 1.3 Connector on port 8009 -->
91 <Connector enableLookups="false" port="8009" protocol="AJP/1.3" redirectPort="8443"/>
92
93 <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
94 <!-- See proxy documentation for more information about using this. -->
95 <!--
96 <Connector port="8082"
97 maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
98 enableLookups="false" acceptCount="100" connectionTimeout="20000"
99 proxyPort="80" disableUploadTimeout="true" />
100 -->
101
102 <!-- An Engine represents the entry point (within Catalina) that processes
103 every request. The Engine implementation for Tomcat stand alone
104 analyzes the HTTP headers included with the request, and passes them
105 on to the appropriate Host (virtual host). -->
106
107 <!-- You should set jvmRoute to support load-balancing via AJP ie :
108 <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
109 -->
110
111 <!-- Define the top level container in our container hierarchy -->
112 <Engine defaultHost="localhost" name="Catalina">
113
114 <!-- The request dumper valve dumps useful debugging information about
115 the request headers and cookies that were received, and the response
116 headers and cookies that were sent, for all requests received by
117 this instance of Tomcat. If you care only about requests to a
118 particular virtual host, or a particular application, nest this
119 element inside the corresponding <Host> or <Context> entry instead.
120
121 For a similar mechanism that is portable to all Servlet 2.4
122 containers, check out the "RequestDumperFilter" Filter in the
123 example application (the source for this filter may be found in
124 "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
125
126 Request dumping is disabled by default. Uncomment the following
127 element to enable it. -->
128 <!--
129 <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
130 -->
131
132 <!-- Because this Realm is here, an instance will be shared globally -->
133
134 <!-- This Realm uses the UserDatabase configured in the global JNDI
135 resources under the key "UserDatabase". Any edits
136 that are performed against this UserDatabase are immediately
137 available for use by the Realm. -->
138 <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
139
140 <!-- Comment out the old realm but leave here for now in case we
141 need to go back quickly -->
142 <!--
143 <Realm className="org.apache.catalina.realm.MemoryRealm" />
144 -->
145
146 <!-- Replace the above Realm with one of the following to get a Realm
147 stored in a database and accessed via JDBC -->
148
149 <!--
150 <Realm className="org.apache.catalina.realm.JDBCRealm"
151 driverName="org.gjt.mm.mysql.Driver"
152 connectionURL="jdbc:mysql://localhost/authority"
153 connectionName="test" connectionPassword="test"
154 userTable="users" userNameCol="user_name" userCredCol="user_pass"
155 userRoleTable="user_roles" roleNameCol="role_name" />
156 -->
157
158 <!--
159 <Realm className="org.apache.catalina.realm.JDBCRealm"
160 driverName="oracle.jdbc.driver.OracleDriver"
161 connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
162 connectionName="scott" connectionPassword="tiger"
163 userTable="users" userNameCol="user_name" userCredCol="user_pass"
164 userRoleTable="user_roles" roleNameCol="role_name" />
165 -->
166
167 <!--
168 <Realm className="org.apache.catalina.realm.JDBCRealm"
169 driverName="sun.jdbc.odbc.JdbcOdbcDriver"
170 connectionURL="jdbc:odbc:CATALINA"
171 userTable="users" userNameCol="user_name" userCredCol="user_pass"
172 userRoleTable="user_roles" roleNameCol="role_name" />
173 -->
174
175 <!-- Define the default virtual host
176 Note: XML Schema validation will not work with Xerces 2.2.
177 -->
178 <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
179
180 <!-- Defines a cluster for this node,
181 By defining this element, means that every manager will be changed.
182 So when running a cluster, only make sure that you have webapps in there
183 that need to be clustered and remove the other ones.
184 A cluster has the following parameters:
185
186 className = the fully qualified name of the cluster class
187
188 clusterName = a descriptive name for your cluster, can be anything
189
190 mcastAddr = the multicast address, has to be the same for all the nodes
191
192 mcastPort = the multicast port, has to be the same for all the nodes
193
194 mcastBindAddr = bind the multicast socket to a specific address
195
196 mcastTTL = the multicast TTL if you want to limit your broadcast
197
198 mcastSoTimeout = the multicast readtimeout
199
200 mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
201
202 mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
203
204 tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
205
206 tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
207 in case of multiple ethernet cards.
208 auto means that address becomes
209 InetAddress.getLocalHost().getHostAddress()
210
211 tcpListenPort = the tcp listen port
212
213 tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
214 has a wakup bug in java.nio. Set to 0 for no timeout
215
216 printToScreen = true means that managers will also print to std.out
217
218 expireSessionsOnShutdown = true means that
219
220 useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
221 false means to replicate the session after each request.
222 false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
223 <%
224 HashMap map = (HashMap)session.getAttribute("map");
225 map.put("key","value");
226 %>
227 replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
228 * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
229 * Synchronous means that the thread that executes the request, is also the
230 thread the replicates the data to the other nodes, and will not return until all
231 nodes have received the information.
232 * Asynchronous means that there is a specific 'sender' thread for each cluster node,
233 so the request thread will queue the replication request into a "smart" queue,
234 and then return to the client.
235 The "smart" queue is a queue where when a session is added to the queue, and the same session
236 already exists in the queue from a previous request, that session will be replaced
237 in the queue instead of replicating two requests. This almost never happens, unless there is a
238 large network delay.
239 -->
240 <!--
241 When configuring for clustering, you also add in a valve to catch all the requests
242 coming in, at the end of the request, the session may or may not be replicated.
243 A session is replicated if and only if all the conditions are met:
244 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
245 2. a session exists (has been created)
246 3. the request is not trapped by the "filter" attribute
247
248 The filter attribute is to filter out requests that could not modify the session,
249 hence we don't replicate the session after the end of this request.
250 The filter is negative, ie, anything you put in the filter, you mean to filter out,
251 ie, no replication will be done on requests that match one of the filters.
252 The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
253
254 filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
255 ending with .gif and .js are intercepted.
256
257 The deployer element can be used to deploy apps cluster wide.
258 Currently the deployment only deploys/undeploys to working members in the cluster
259 so no WARs are copied upons startup of a broken node.
260 The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
261 When a new war file is added the war gets deployed to the local instance,
262 and then deployed to the other instances in the cluster.
263 When a war file is deleted from the watchDir the war is undeployed locally
264 and cluster wide
265 -->
266
267 <!--
268 <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
269 managerClassName="org.apache.catalina.cluster.session.DeltaManager"
270 expireSessionsOnShutdown="false"
271 useDirtyFlag="true"
272 notifyListenersOnReplication="true">
273
274 <Membership
275 className="org.apache.catalina.cluster.mcast.McastService"
276 mcastAddr="228.0.0.4"
277 mcastPort="45564"
278 mcastFrequency="500"
279 mcastDropTime="3000"/>
280
281 <Receiver
282 className="org.apache.catalina.cluster.tcp.ReplicationListener"
283 tcpListenAddress="auto"
284 tcpListenPort="4001"
285 tcpSelectorTimeout="100"
286 tcpThreadCount="6"/>
287
288 <Sender
289 className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
290 replicationMode="pooled"
291 ackTimeout="15000"/>
292
293 <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
294 filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
295
296 <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
297 tempDir="/tmp/war-temp/"
298 deployDir="/tmp/war-deploy/"
299 watchDir="/tmp/war-listen/"
300 watchEnabled="false"/>
301
302 <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
303 </Cluster>
304 -->
305
306
307
308 <!-- Normally, users must authenticate themselves to each web app
309 individually. Uncomment the following entry if you would like
310 a user to be authenticated the first time they encounter a
311 resource protected by a security constraint, and then have that
312 user identity maintained across *all* web applications contained
313 in this virtual host. -->
314 <!--
315 <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
316 -->
317
318 <!-- Access log processes all requests for this virtual host. By
319 default, log files are created in the "logs" directory relative to
320 $CATALINA_HOME. If you wish, you can specify a different
321 directory with the "directory" attribute. Specify either a relative
322 (to $CATALINA_HOME) or absolute path to the desired directory.
323 -->
324 <!--
325 <Valve className="org.apache.catalina.valves.AccessLogValve"
326 directory="logs" prefix="localhost_access_log." suffix=".txt"
327 pattern="common" resolveHosts="false"/>
328 -->
329
330 <!-- Access log processes all requests for this virtual host. By
331 default, log files are created in the "logs" directory relative to
332 $CATALINA_HOME. If you wish, you can specify a different
333 directory with the "directory" attribute. Specify either a relative
334 (to $CATALINA_HOME) or absolute path to the desired directory.
335 This access log implementation is optimized for maximum performance,
336 but is hardcoded to support only the "common" and "combined" patterns.
337 -->
338 <!--
339 <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
340 directory="logs" prefix="localhost_access_log." suffix=".txt"
341 pattern="common" resolveHosts="false"/>
342 -->
343 <!-- Access log processes all requests for this virtual host. By
344 default, log files are created in the "logs" directory relative to
345 $CATALINA_HOME. If you wish, you can specify a different
346 directory with the "directory" attribute. Specify either a relative
347 (to $CATALINA_HOME) or absolute path to the desired directory.
348 This access log implementation is optimized for maximum performance,
349 but is hardcoded to support only the "common" and "combined" patterns.
350
351 This valve use NIO direct Byte Buffer to asynchornously store the
352 log.
353 -->
354 <!--
355 <Valve className="org.apache.catalina.valves.ByteBufferAccessLogValve"
356 directory="logs" prefix="localhost_access_log." suffix=".txt"
357 pattern="common" resolveHosts="false"/>
358 -->
359
360
361
362 </Host>
363
364 </Engine>
365
366 </Service>
367
368 </Server>
 
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.