cPanel & WHM no longer develops or updates EasyApache 3. We deprecated EasyApache 3 on December 31, 2018. We removed support for EasyApache 3 in cPanel & WHM version 78.
Introduction to Tomcat - EasyApache - cPanel Documentation
Page tree
Skip to end of metadata
Go to start of metadata



  • We strongly recommend that only experienced Tomcat administrators install Tomcat.
  • If you select the MPM ITK option in the EasyApache 3 interface (Home >> Software >> EasyApache 3), you cannot install Tomcat.
  • The Tomcat service requires the you add the tomcat user to the nobody user group. If you already use Tomcat, EasyApache will change the group ID of the tomcat user to the nobody user group.
  • Tomcat is not available on servers that run CentOS 7, CloudLinux™ 7, or Red Hat® Enterprise Linux (RHEL) 7.
  • EasyApache 3 does not support new installations of Tomcat.
  • EasyApache 4 now supports Tomcat 8.5 on an Experimental basis. You must install the Experimental Repository to use Tomcat and create a new Tomcat installation. You cannot migrate from EasyApache 3 to EasyApache 4 if your server runs Tomcat. We will add this functionality in cPanel & WHM version 76. For more information, read our Tomcat documentation.


This document is for Tomcat 7. For information on Tomcat 5.5, read our Migrate from Tomcat 5.5 to Tomcat 7 documentation.


Apache Tomcat is an Apache module that provides a web server in addition to the Apache web server. The Tomcat web server supports Java Servlets and JavaServer pages.

For more information about the Apache Tomcat open-source project, visit the Apache Tomcat website.

How Tomcat works

EasyApache configures the Tomcat server to listen on port 8009, port 80, and, if you use SSL, port 443. The Tomcat web server listens on port 8080 for direct requests.


Your server's firewall must allow internal connections on port 8009.

For more information on the topics in the following sections, read Apache Tomcat's The Apache Tomcat Connector - Reference Guide documentation.

For more information on how Apache works, read our Apache documentation.


Featured documentation

  EasyApache 3


Change Log Release Notes  



Migrate from Tomcat 5.5 to 7

How to Deploy Java Applications


EasyApache 3 does not support new installations of Tomcat.

As of cPanel & WHM version 76, EasyApache 4 now supports Tomcat 8.5. For more information, read our Tomcat documentation.

Port 80 or 443

If a client browser sends a request on port 80 or 443, the Apache web server receives the request and the following actions occur:

  1. Apache reads the request. If the request is for content that requires the Tomcat web server, Apache translates the request from the HTTP protocol to the AJP protocol. Then, Apache sends the request to port 8009.


    Apache can translate to the AJP protocol and send the request to port 8009 because of the configuration of the mod_jk Apache module.

  2. The Tomcat web server uses Tomcat's Apache connector with the AJP/1.3 protocol to listen on port 8009 for requests from Apache. It receives the request, reads it, translates the request so that a Tomcat worker can read it, and sends the request to a Tomcat worker.
  3. The Tomcat worker handles the request, and then returns the results of the request to the Tomcat's Apache connector on the Tomcat web server.
  4. Tomcat's Apache connector translates the results of the request so that the Apache web server can read it, and sends the results out of the Tomcat server on port 8009.
  5. Apache's Tomcat connector receives the results, translates it to the HTTP protocol, and directs the Apache web server to send the information to the browser client.

Diagram of process over port 80 or 443:

Port 8080

If a client browser sends a request on port 8080, the Tomcat web server responds to the request directly.


The Tomcat connector that listens on port 8080 uses the HTTP/1.1 protocol.

Diagram of process over port 8080:

How to install Tomcat

Installation requirements

You must have root-level access to install Tomcat. 


Tomcat is not available on servers that run CentOS 7, CloudLinux 7, or RHEL 7. 

Installation steps


In the following examples, represents your domain.

Step 1: Install Tomcat

To install Tomcat, select the Tomcat 7 option in the Short Options List stage of WHM's EasyApache 3 interface (Home >> Software >> EasyApache 3.

EasyApache automatically inserts the module directive into your Apache configuration.

Step 2: Enable Java servlets on your sites

Enable Java servlets via WHM

To enable Java servlets for a site via WHM, perform the following steps:

  1. Navigate to WHM's Install Servlets interface ( Home >> Account Functions >> Install Servlets).


    This option does not appear until you install Tomcat on your server.

  2. Select the account in the Account Selection table and click Install.
  3. Navigate to the  URL for your domain to test the installation.  


  • You can only add servlet support to domains and subdomains.
    • To add servlet support to a parked domain (alias), add servlet support to the primary domain.
    • To add servlet support to an addon domain, add servlet support to the associated subdomain.
  • You cannot add servlet support to subdomains via WHM. Use the command line interface to add servlet support to subdomains.
Enable Java servlets via CLI

To enable Java servlets for a site via the command line, run the following command as the root user:


To enable Java servlets for a subdomain or addon domain, run the following command on the associated subdomain:


If you enable Java servlets for a domain, cPanel & WHM performs the following actions:

  • cPanel & WHM creates a container for the site in the server.xml file.  
  • cPanel & WHM creates a default cp_jkmount.conf file for the site.
  • cPanel & WHM copies the jsptest.jsp file into the site’s document root.

To confirm that Java servlets work for the domain, navigate to the  URL for your domain. The page should appear similar to the following example:

Example output from the jsptest.jsp  url

How to remove Tomcat servlets from a site

To remove Tomcat servlets from a site via the command line, run the following script as the root user:



This script removes the container for the site from the /usr/local/easy/etc/easy-tomcat7/server.xml Tomcat server configuration file, and removes the cp_jkmount.conf site configuration file from each subdirectory for the domain within the /usr/local/apache/conf/userdata/ directory.

For example, the script removes cp_jkmount.conf file from the following directories:

  • /usr/local/apache/conf/userdata/std/2/$user/$domain/
  • /usr/local/apache/conf/userdata/ssl/2/$user/$domain/

How to deploy Java applications

After you enable Java servlets for a domain, the user can deploy Java applications on their web site. Java distributes many applications in convenient WAR packages that you can easily to install on your server.

For more information on how to deploy Java applications, read our How to Deploy Java Applications documentation.

How to manually deploy a WAR file

To manually deploy a WAR file, put the WAR file into the user's public_html directory. Once placed, you can access the application through the following address:

Then, add a JkMount entry for the application in the mod_jk file:

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

You must restart the httpd daemon to reload the mod_jk file with the new entry.

ROOT.war does not deploy automatically

ROOT.war does not deploy automatically. The index context of all cPanel & WHM hosts is hardcoded to the $CATALINA_HOME/conf/server.xml file.

For example: 

<Host name="reseller.example" appBase="/home/reseller/public_html">
<Context path="" reloadable="true" docBase="/home/reseller/public_html" debug="1"/>
<Context path="/manager" debug="0" privileged="true"

Tomcat components

Tomcat will install the following components on your server:

The Java Development Kit (JDK)

The vendor RPM determines this location.

This directory contains the Java Runtime Environment (JRE).
The Binary Tomcat DistributionThe /usr/local/easy/share/easy-tomcat7/ directoryThis distribution is precompiled Java byte code, which Tomcat downloads and extracts. The $CATALINA_HOME  and $CATALINA_BASE variables point to this location.
Apache Tomcat Connectors (mod_jk) in the Apache modules directoryThese connectors allow Apache to communicate with Tomcat.
cPanel-Provisioned Maintenance Scripts cPanel & WHM uses these maintenance scripts instead of the Tomcat initialization scripts. They create and remove Tomcat virtual hosts.

Important Tomcat files and directories

File name or directoryDescription
The Tomcat output log.

The Tomcat error log.

The error log marks errors with the following severity levels:

  • INFO

The following command returns any SEVERE or WARNING level messages in the command line interface (CLI):

tail -f /var/log/easy-tomcat7/catalina.err | egrep -A2 '(SEVERE|WARNING):' &

Tomcat uses cPanel & WHM's default logging facility, Valve.

Tomcat also uses the CentOS-provided logrotate.d file to manage log rotation. Tomcat rotates logs weekly and keeps them for one year.

/usr/local/apache/logs/mod_jk.logApache's log for the mod_jk Apache module.

Tomcat's options file.

Each argument in the options file is defined on a separate line, parsed, and then passed to jsvc (Commons Daemon).

  • For more information about JSVC Options in Tomcat, run the following command:

    /usr/local/easy/bin/jsvc -help
  • For more information about JVM Hotspot Options, read Oracle's Java HotSpot VM Options documentation.


The Tomcat server configuration file directory.

/usr/local/easy/share/easy-tomcat7/conf/server.xmlConfigures Virtual Hosts, Connectors, and more. While each instance of Tomcat has its own copy of the  server.xml file, cPanel & WHM only supports a single instance of the server.xml file.
The configuration file for the mod_jk Apache module. For more information on this file, read Apache Tomcat's Apache HTTP Server HowTo documentation.
/usr/local/easy/share/easy-tomcat7/conf/ Defines the parameters that Apache uses to communicate with Tomcat workers. For more information on this file, read Apache Tomcat's Apache HTTP Server HowTo documentation.




The site configuration file. This file exists for each site that uses Tomcat.

Each site with Java Servlets or JavaServer contains a cp_jkmount.conf file in the following directories:

  • /usr/local/apache/conf/userdata/std/2/$user/$domain/
  • /usr/local/apache/conf/userdata/ssl/2/$user/$domain/

The cp_jkmount.conf file contains a contextual path to the Tomcat worker that you wish the site to use.

When EasyApache builds your Apache configuration, it uses the following entry in the /usr/local/apache/conf/httpd.conf file to include the cp_jkmount.conf file in the VirtualHost tag for that site:

Include "/usr/local/apache/conf/userdata/std/$2/$user/$domain/*.conf"

The following is an example of a cp_jkmount.conf file:

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

For more information on the include file format for Apache, read our Modify Virtualhost Containers with Include Files documentation.