We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.
We will continue to maintain our API documentation on this server.
You must have
root-level access to install Tomcat.
Tomcat is not available on servers that run CentOS 7, CloudLinux 7, or RHEL 7.
In the following examples,
example.com represents your domain.
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
mod_jk.so module directive into your Apache configuration.
To enable Java servlets for a site via WHM, perform the following steps:
Navigate to WHM's Install Servlets interface ( Home >> Account Functions >> Install Servlets).
This option does not appear until you install Tomcat on your server.
To enable Java servlets for a site via the command line, run the following command as the
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:
cp_jkmount.conffile for the site.
jsptest.jspfile into the site’s document root.
To confirm that Java servlets work for the domain, navigate to the
Example output from the
To remove Tomcat servlets from a site via the command line, run the following script as the
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
For example, the script removes
cp_jkmount.conf file from the following directories:
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.
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
You must restart the
httpd daemon to reload the
mod_jk file with the new entry.
ROOT.war does not deploy automatically. The index context of all cPanel & WHM hosts is hardcoded to the
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 Distribution||The ||This distribution is precompiled Java byte code, which Tomcat downloads and extracts. The |
|Apache Tomcat Connectors (mod_jk)||These 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.|
|File name or directory||Description|
|The Tomcat output log.|
The Tomcat error log.
The error log marks errors with the following severity levels:
The following command returns any
Tomcat uses cPanel & WHM's default logging facility, Valve.
Tomcat also uses the CentOS-provided
|Apache's log for the |
Tomcat's options file.
Each argument in the options file is defined on a separate line, parsed, and then passed to
The Tomcat server configuration file directory.
|Configures Virtual Hosts, Connectors, and more. While each instance of Tomcat has its own copy of the |
|The configuration file for the |
|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
When EasyApache builds your Apache configuration, it uses the following entry in the
The following is an example of a
For more information on the include file format for Apache, read our Modify Virtualhost Containers with Include Files documentation.