Tomcat Server configuration
Tomcat Docs
The following is an explaination of the tomcat configuration (server.xml) file
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<!-- todo remove for prod -->
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />--> <!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
maxThreads="200" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100" /> <!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost" jvmRoute="lb1">
<Host name="localhost" appBase="webapps" unpackWARs="false"
autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="{localtion of web abpp}" debug="0"
reloadable="false" crossContext="false" allowLinking="true">
</Context>
</Host> <Host name="www.marandcustomsolutions.com">
<Alias>marandcustomsolutions.com</Alias>
<Alias>www.marandcustomsolutions.com.au</Alias>
<Alias>marandcustomsolutions.com.au</Alias>
<Context path="" docBase="{localtion of web abpp}" debug="0"
reloadable="false" crossContext="false" allowLinking="true">
</Context>
</Host> </Engine>
</Service>
</Server>
Explaination of various elements follow:
<Server port="8005" shutdown="SHUTDOWN">
- port:is the port to contact
- shutdown: is the command to issue when wanting to shutdown tomcat. (This is only possible from localhost)
<Engine name="Catalina" defaultHost="localhost" jvmRoute="lb1">
- name:Logical name of this Engine, used in log and error messages.
- defaultHost:The default host name, which identifies the Host that will process requests directed to host names on this server, but which are not configured in this configuration file. This name MUST match the name attributes of one of the Host elements nested immediately inside.
- jvmRoute:Identifier which must be used in load balancing scenarios to enable session affinity. The identifier, which must be unique across all Tomcat 5 servers which participate in the cluster, will be appended to the generated session identifier, therefore allowing the front end proxy to always forward a particular session to the same Tomcat 5 instance.
<Host name="www.marandcustomsolutions.com">
<Alias>marandcustomsolutions.com</Alias>
<Alias>www.marandcustomsolutions.com.au</Alias>
<Alias>marandcustomsolutions.com.au</Alias>
<Context path="" docBase="{localtion of web abpp}" debug="0"
reloadable="false" crossContext="false" allowLinking="true">
</Context>
</Host>
- name:Network name of this virtual host, as registered in your Domain Name Service server. One of the Hosts nested within an Engine MUST have a name that matches the defaultHost setting for that Engine.
- <Alias>:Network names should resolve to the same virtual host, running the same set of applications. A common use case for this scenario is a corporate web site, where it is desireable that users be able to utilize either www.mycompany.com or company.com to access exactly the same content and applications.
- docBase:The Document Base (also known as the Context Root) directory for this web application, or the pathname to the web application archive file (if this web application is being executed directly from the WAR file). You may specify an absolute pathname for this directory or WAR file, or a pathname that is relative to the appBase directory of the owning Host
- path:The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts. The value of this field must not be set except when statically defining a Context in server.xml, as it will be infered from the filenames used for either the .xml context file or the docBase.
- reloadable:Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.
- allowLinking:If the value of this flag is true, symlinks will be allowed inside the web application, pointing to resources outside the web application base path. If not specified, the default value of the flag is false.NB: do not use this on windows