Page tree
Skip to end of metadata
Go to start of metadata

Overview

Notes:

  • Apache Tomcat® requires cPanel & WHM version 76 or higher.
  • We  strongly  recommend that only experienced Tomcat administrators use Tomcat.

Tomcat runs as a per-user private instance. This allows each cPanel account user to manage their own Tomcat services and configuration. 

Private instances

Each user's instance of Tomcat runs its applications as the user. The user can stop and start services, and manage their Tomcat configuration to suit their needs. This differs from the EasyApache 3 implementation, where users shared the Tomcat implementation. 

The private instance approach increases the security of your system and operates on the user's designated ports. 

Configuration

Note:

A cPanel user must possess shell access to perform these actions.

When you enable Tomcat for a user account, the system sets up a blank environment for the user. The system creates the environment in the following location, where user represents the user's username:

/home/user/ea-tomcat85/conf

Default configuration

EasyApache 4 makes the following configuration changes from the default Tomcat 8.5 behavior to the ~/ea-tomcat85/conf/server.xml file:

  • Disables the shutdown port by default.
  • Sets the xpoweredBy attribute of all Connectors to a false value.
  • Adds the ErrorReportValue class to all hosts with the  showServerInfo value set to a false value.
  • Sets the following host attributes to a false value:
    • autoDeploy
    • deployOnStartup
    • deployXML

Configure applications

To use the Tomcat instance, configure the desired applications in the /home/user/ea-tomcat85/webapps directory. You can also set up a proxy to point to the app's location. For more information about proxies, read our Tomcat Proxies documentation. 

We provide the /opt/cpanel/ea-tomcat85/test.jsp test script that the user can use to test whether their Tomcat configuration works. 

Note:

If you migrated from EasyApache 3 to EasyApache 4, the system configured each Tomcat user's domains in the user's  ~/ea-tomcat85/conf/server.xml file. It also set up include files with a proxy to duplicate the EasyApache 3 proxy behavior.

Proxies

You must set up Apache proxies manually. You can also configure Tomcat to mimic the EasyApache 3 proxy behavior in a personal instance. For more information, read our Tomcat Proxies documentation.

Manage services as a user

To manage services in Tomcat, users can use the the  cpuser_service manager and Ubic subsystem. This script adds services and allows users to easily stop and restart their services.

For example, run the following command on the command line to restart your Tomcat service:

ubic restart ea-tomcat85

Note:

If Ubic does not exist in your PATH, you must add it to your configuration. For example, you might add the following line to your .bashrc file:

export PATH=$(dirname $(readlink /usr/local/cpanel/3rdparty/bin/perl)):$PATH

Important:

Jailshell users cannot see the status of their previously started Tomcat service. The default jailshell permissions only allow users to view their current session's processes. If they attempt to restart an already active service with Ubic, the system will launch a duplicate process.

Tomcat security

If your desired Tomcat applications support it, we strongly recommend that you enable Tomcat's Security Manager. This adds extra security, but may break some applications. For more information, read Tomcat's Security Manager How To documentation. 

Additional documentation