IndianWebPortal.com

Something Different In Linux

Home » Tomcat » Basic tomcat configuration

Basic tomcat configuration

Posted by Rishikesh Vispute Categories: Tomcat

What is Tomcat?

Tomcat is Java driven Web Application Server which Provides support for Java web applications. ie. JSP technologies.
-WAR (Web Application aRchive) files

– Has a self-contained HTTP server

CATALINA_HOME

/usr/local/jakarta/tomcat

CATALINA_BASE

/usr/local/jakarta/tomcat

JAVA_HOME ( The path to the JDK )

JAVA_HOME=/usr/local/jdk

Logs :

/usr/local/jakarta/tomcat/logs/catalina.out

tail -f /usr/local/jakarta/tomcat/logs/catalina.out | egrep domain.com

By default, all WAR files are automatically deployed at start up. It can be disabled on a per-host basis with the deployOnStartup attribute.

/usr/local/jakarta/tomcat/bin/jsvc -help

Configuration files reside in :

/usr/local/jakarta/tomcat/conf/

Most configurations are stored in XML formatted documents

/usr/local/apache/conf/httpd.conf

LoadModule jk_module modules/mod_jk.so

/usr/local/apache/conf/jk.conf

JkWorkersFile /usr/local/jakarta/tomcat/conf/workers.properties
JkLogFile /usr/local/apache/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”

# find /usr/local/apache/conf/ -iname cp_jkmount.conf | head -2
/usr/local/apache/conf/userdata/std/1/tom/tomcat.com/cp_jkmount.conf
/usr/local/apache/conf/userdata/std/2/tom/tomcat.com/cp_jkmount.conf

Site configurations are included from the Apache userdata directories

<VirtualHost 10.0.0.1:80>
ServerName tomcat.com
…..
Include “/usr/local/apache/conf/userdata/std/2/tom/tomcat.com/*.conf”
</VirtualHost>

cp_jkmount.conf

Example Configuration
JkMount is used to map a context path to a Tomcat worker.

<IfModule mod_jk.c>
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
</IfModule>

unzip filename.war

# unzip example.war
Archive: example.war
creating: META-INF/
inflating: META-INF/MANIFEST.MF
inflating: helloworld.jsp
creating: WEB-INF/
inflating: WEB-INF/web.xml
inflating: index.html
#

The appBase is scanned for WAR files every 10 seconds

/usr/local/jakarta/tomcat/work/Catalina/example.com/war_file_name/

Check catalina.out to confirm application deployment

How  to deploy web application archive in cpanel account : WAR Deployment :: Configuring mod_jk

  • Drop the WAR file in a directory in the user’s public_html directory
  • mod_jk must be configured to recognize the application now.
  • Add a JkMount code for the application to site include and restart httpd

Example Configuration

<IfModule mod_jk.c>
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /appname/* ajp13
</IfModule>

Resources and References :

Tomcat Project Page : http://tomcat.apache.org/
JDK Download Site : http://www.oracle.com/technetwork/java/javase/downloads/index.html
Useful Tomcat configuration tips : http://oreilly.com/java/archive/tomcat-tips.html

3 Responses so far.

  1. Keanu says:

    Thanks alottttttttttttttt !!

  2. Hello,

    Thanks for the information.

    Regards,
    Yogesh.


Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...