The Tomcat Servlet Container
Tomcat settings in an production environment?
I'm currently about to go live with a webapp I've been working on for some time. I'm using Tomcat 220.127.116.11 as a server, and in that regard I've got some questions.Should I place my webapp under the ROOT folder in Tomcat?$CATALINA_HOME/webapps/ROOT/If not how else can I get the webapp to be displayed at the Tomcat root? I.ehttp://www.mysite.com/and nothttp://www.mysite.com/mywebapp/Are there any other Tomcat settings that needs to be changed in an production environment?All advices are much appreciated!
Renaming your webapp to ROOT and placing under the webapps directory is the easiest way to deploy it as the root app on the server.Tomcat, pretty much ships in production mode.I usually change thing more for development mode.You might want to un-deploy any of the apps that ship with Tomcat (unless you're actually using them).I keep the manager app around but I re-name it.I also turn off directory browsing (from conf/web.xml) and build my own 404 error page that doesn't show the make and model of the appserver to any would be cracker.--------------------Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples
Thank you for the informative reply!How can I prevent Tomcat from displaying stack traces in case of unforeseen errors? Is that also in conf/web.xml perhaps?Do you have any idea how the performance on Tomcat is compared to other lightweight servers (like i.e. Resin).[ September 23, 2006: Message edited by: Egil Poma ]
You can create a custom 500 error page (as well as a custom 404 error page) for you app and map them with the web.xml file under your app's WEB-INF directory.Example:code:<error-page><error-code>404</error-code><location>/404-error.jsp</location></error-page><error-page><error-code>500</error-code><location>/500-error.jsp</location></error-page></web-app>--------------------Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples
The default servlet, is mapped in the tomcat/conf/web.xml.This is where you would shut off directory browsing for all of Tomcat.code:<!-- listings Should directory listings be produced if there --><!-- is no welcome file in this directory? [false] --><!-- WARNING: Listings for directories with many --><!-- entries can be slow and may consume --><!-- significant proportions of server resources. --><!-- --><--------------------Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples