Tomcat configuration

922 views
838 views

Published on

Simple configuration for Tomcat servlet container

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
922
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Tomcat configuration

  1. 1. Prepared by: Dima Gomaa
  2. 2.  Tomcat is a Servlet container (Web server that interacts withSe rvle ts ) developed under the Jakarta Project of Apache SoftwareFoundation Tomcat implements the Se rvle t and the Java Se rve r Pag e s (JSP)specifications of Sun Microsystems Tomcat is an open-source, non commercial project◦ Licensed under the Apache Software License Tomcat is written in Java (OS independent)
  3. 3. Tomcat is a free open source implementation of java server pagesand java servlets, developed as part of the Jakarta projectunder the Apache Software FoundationMore info at:http://tomcat.apache.org/
  4. 4.  To use Tomcat web server working need to know about: Environment variables How to start and stop the server How to configure Tomcat to pick up web files from your directory
  5. 5.  Extract source zip file into a directory on hard disk. Default directoryis jakarta-tomcat-ve rsio n#. A set of subdirectories are automatically created (bin, conf, doc etc)Tomcat uses two environment variables: environment variables:◦ JAVA_HOME and CATALINA_HOME
  6. 6.  Extract source zip file into a directory on hard disk. Default directoryis jakarta-tomcat-ve rsio n#. A set of subdirectories are automatically created (bin, conf, doc etc) Tomcat uses two environment variables: environment variables:◦ JAVA_HOME (point to directory containing JDK)◦ CATALINA_HOME (point to directory containing Tomcat)
  7. 7.  From UNIX shell prompt, go to where Tomcat is installed◦ dgomaa_debian: cd /usr/local/jakarta-tomcat-1.6… Go to the subdirectory bin To START:◦ ./startup.sh Tomcat server executes on TCP port 8080 (in case anotherserver is using the default port 80)
  8. 8.  To test Tomcat, in browser type URL:http://hostname:8080/ This will access the Tomcat documentation welcome page ifserver working properly To STOP Tomcat when it is running◦ ./shutdown .sh
  9. 9.  By default, Tomcat looks in its own WEBAPPS directory for webapplication files (e.g. jsps, html etc) To hold application files elsewhere, need to edit the se rve r. xm lconfiguration file (in the conf directory) to look in alternate location.Both <host> and <context> element need to be changed -NOTE: Always make a backup of server.xml before changing!In server.xml: change Host name parameter appbase from ‘webapps’ to thepreferred directory you want <Host name="localhost"debug="0"appBase=“/home/dgomaa/tomcat-apps/webapps" reloadable ="true"
  10. 10. To set up an application directory: -To create a new web application (e.g. newapp) in yourweb application directory Tomcat directory :◦ create a subdirectory of your WEBAPPs directory in which to holdthe web application files◦ This directory is now the top level directory for the web applicationnewapp, accessed as http://www.domainname/newapp
  11. 11.  An applications directory must contain the following:◦ The directory WEB-INF/◦ A legal web.xml file under WEB-INF/<web-app></web-app>
  12. 12.  Environment variable java_home incorrect Not putting 8080 in URL (http://localhost:8080) Not configuring server.xml to look at correct location of your webfiles Not starting the server… Not re-starting the server when you’ve added/ changed your files Not re-setting the environment variables when shell re-started

×