Setup Guide For Tomcat 8 and EasyApache

April 26, 2022 / General Discussion

In this tutorial, we’ll explain how Tomcat 8 and EasyApache Setup Guide

The article will show you to set up a test application with Tomcat 8 and EasyApache. This is the best way to understand the basic concepts for setting up a Tomcat application and to verify that tomcat works on your cPanel server.

This procedure is done through SSH as the root user.

You can copy and paste these commands directly as they are presented and if you are simply creating a test account to verify that Tomcat is working on the server. Even you can replace the example username and domain with your own set up a new account with a working test application to start with.


  1. Check that the required packages are installed:
    yum install ea-tomcat85 rng-tools -y
  2. Create a test account that you can use temporarily to verify that Tomcat is working:
    whmapi1 createacct username=tcattest domain=tcat.tld 
    password=$(openssl rand -base64 12)
  3. Add Tomcat to the user:
    /scripts/ea-tomcat85 add tcattest
  4. Add access to the ubic utility for the user’s shell:
    echo "export PATH=$(dirname $(readlink /usr/local/cpanel/3rdparty/bin/perl))
    :$PATH" >> /home/tcattest/.bashrc
  5. If server is using Cloudlinux, you need to run the command given are given below to add java to the Cagefs mount.
    cagefsctl --addrpm tzdata-java
    cagefsctl --force-update
  6. Add the required context within the <Host … > element of the server.xml configuration:
    <Context path="/" docBase="/home/tcattest/ea-tomcat85/webapps/ROOT/">
     The result should look like the following within the server.xml file:
    <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" 
    deployOnStartup="false" deployXML="false">
    <Context path="/" docBase="/home/tcattest/ea-tomcat85/webapps/ROOT/">
  7. Copy the test application into place:
    sudo -u tcattest cp -avp /opt/cpanel/ea-tomcat85/test.jsp 
  8. Restart the Tomcat Private Instance:
    su - tcattest -s /bin/bash -c 'ubic restart ea-tomcat85'
  9. Locate the connector port:
    egrep 'Connector port.*HTTP' /home/tcattest/ea-tomcat85/conf/server.xml
  10. Use the port found from the command above along with your server’s public IP to verify that the test application is working properly: 
    lynx --dump http://x.x.x.x:CONNECTORPORTHERE/test.jsp
  11. Locate the AJP port:
    egrep 'Connector port.*AJP' /home/tcattest/ea-tomcat85/conf/server.xml
  12. Setup a ProxyPass configuration so that Apache can serve the application.
    A more detailed guide found below that includes an example for port 443 (https):
    How to Proxy Tomcat to Apache
    <IfModule proxy_ajp_module>
    ProxyPass "/cptest" "ajp://"
  13. Rebuild the Apache configuration and restart Apache:
    /scripts/rebuildhttpdconf && /scripts/restartsrv_httpd
  14. For final test works, you can update the host file with your test domain
    How to Modify Your Hosts File
  15. Test with the domain to verify that the ProxyPass configuration works:
    lynx --dump http://tcat.tld/test.jsp

We hope that you will now be able to successfully add a contact from the bodhost client area.

Leave a Reply

Your email address will not be published. Required fields are marked *