Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After installing Tomcat 5 what configuration changes/tweaks do you apply, and why?

Be specific: name what files you edit, what settings you change and why you do it.

Some areas of interest:

  • General configuration changes
  • Best practices with regards to "virtual host handling"
  • Performance tweaks
  • Stability tweaks
  • Security settings
share|improve this question
add comment

5 Answers

Usually, I'm just tweaking startup parameters to adjust Heap sizes for better performance.

-server -Xms256m -Xmx1024m
share|improve this answer
add comment

Here is the simple script I use :

I have the default directoy "Catalina Home' and 'Catalina Base' I put the webapps into 'Catalina base' every time I launch my scripts, war are deployed. I also have some JAVA_OPTS : like run Java in deamon mode, I specify the memory I want to allocate I add the Timezone Also

#!/bin/sh

BIN_DIR=$HOME/bin
TOMCAT_DIR=$HOME/tomcat
CFG_DIR=$TOMCAT_DIR/conf

#export TZ="Europe/Paris"
#export LANG=fr_FR.UTF-8 export CATALINA_PID=$BIN_DIR/tomcat.pid
export CATALINA_BASE=$TOMCAT_DIR
export
CATALINA_HOME=/home/web/bin/apache-tomcat-6.0.16
export
LD_LIBRARY_PATH=$CATALINA_HOME/lib
export
JRE_HOME=/usr/lib/jvm/java-1.5.0-sun
export JAVA_OPTS="-server -Xmx800m
-Djava.awt.headless=true -XX:MaxPermSize=256m"

cd $CATALINA_HOME/bin

case $1 in

    start)
    $CATALINA_HOME/bin/catalina.sh start
-config $TOMCAT_DIR/conf/server.xml "$@"    ;;

    stop)   $CATALINA_HOME/bin/catalina.sh
stop -force -config
$TOMCAT_DIR/conf/server.xml "$@"    ;;

    deploy)     if [ ! -d $HOME/deploy ];
then        mkdir $HOME/deploy      fi  if [
-f $HOME/deploy/*.war ]; then       mv $HOME/deploy/*.war
$HOME/tomcat/webapps/   fi  ;;

    *)  echo "Usage : $0 (start|stop)"
    ;;

esac
share|improve this answer
add comment

In context configuration for webapps, which may be in ./conf/Catalina/localhost/.xml, ./webapps/.xml, or within ./conf/server.xml, I set reloadable="false". This prevents Tomcat from constantly polling for changes to the webapp's class files and jars, which is an unnecessary load. See the Context configuration documentation.

<Context path="/myapp" reloadable="true">

In ./conf/server.xml I go through and comment out bits I'm not using, such as unused connectors.

In ./conf/server.xml, look at the values for maxThreads, connectionTimeout, and similar attributes of the Connectors. There is no standard recommended value for these, you need to work out the optimal values based on your application, usage patterns, etc. See the documentation for the HTTP Connector and the AJP Connector for details.

I also strip out the default webapps, except for the ones I need.

Since I do use the tomcat-manager webapp, I lock it down. I configure the user account to access it, and configure Apache httpd access controls on the URL to lock access to relevant IP addresses.

Order deny,allow Deny from all Allow from 127.0.0.1 Allow from 192.168.0

Also in Apache, I block access to the WEB-INF directory (I don't have an example to hand).

share|improve this answer
add comment

Heap size for tweaking is better

share|improve this answer
add comment

Another good source of information would be this webinar

http://www.springsource.com/webinar/apache-tomcat-tips-and-tricks-pros

Unfortunately you have to register....

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.