Tomcat Installation and configuration on cpanel
Apache Tomcat (also known as Tomcat) is an open-source implementation of Java Servlets and JavaServer pages. Tomcat uses a self-contained HTTP server to provide support for Java web applications.
Use this Tomcat installation and configuration on cpanel. Click the checkbox for Tomcat at the Short Options List stage of EasyApache within WHM.
To install Tomcat, select the Tomcat option in WHM’s EasyApache (Apache Update) or using “/scripts/easyapache” (without the quotes) in command line. The Tomcat selection is found in Short Options List area.
Once installation completed. You can enable for account via WHM-> Account Functions->Install Servlets. Select the account in the Account Selection table and click the Install button.
You would need to use command line for adding subdomain support for servlets as they do not automatically include that support and WHM does not have any option to add servlets to subdomains.
Addon domains will not work when added using command line if added by the addon domain name. The /usr/local/apache/conf/httpd.conf ServerName sub.domain.com line is what is used and it must match the Host name=”sub.domain.com” line in /usr/local/jakarta/conf/server.xml file exactly, so addon domain support is added by installing servlets onto the subdomain associated with the addon domain:
Manually check the setting for the domain. Open up the Apache conf /usr/local/apache/conf/httpd.conf
make sure tomcat module load
LoadModule jk_module /usr/local/apache/modules/mod_jk.so
check if the directive given below in the virtual host entry of domain, if not add it.
Now navigate to the directory
check whether the folder named username(replace username with appropriate username) exist if not, create it.
If the directory “domainname” is not present, create it
Check for the file cp_jkmount.conf here, if it is not present, create it with the following contents
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
Verify the file /usr/local/jakarta/tomcat/conf/server.xml Add the entry for host
<Host name=”domainname” appBase=”/home/username/public_html”>
<Context path=”" reloadable=”true”
<Context path=”/manager” debug=”0″ privileged=”true”
Restart the services
service httpd restart
The username and password for accessing Tomcat manager is stored in /usr/local/jakarta/tomcat/conf/tomcat-users.xml file such as the following:
Sample JSP file code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD><TITLE>JSP Test</TITLE></HEAD> <BODY BGCOLOR="#FDF5E6"> <H1>JSP Test</H1> Time: <%= new java.util.Date() %> </BODY> </HTML>
Powered by WHMCompleteSolution