How to enable Tomcat for a domain in cPanel
To enable .jsp pages for a domain
# /scripts/addservlets –domain=example.com
To disable .jsp pages for a domain
# /scripts/remservelets –domain=example.com
In some cases, these scripts won’t work. Manually check the setting for the domain.
1. Open up the Apache configuration file /usr/local/apache/conf/httpd.conf
# vim /usr/local/apache/conf/httpd.conf
2. Check if the directive given below in the virtual host entry of domain, if not add it.
———————————————————————————————————————–
Include “/usr/local/apache/conf/userdata/std/2/username/domainname/*.conf”
———————————————————————————————————————–
3. Now navigate to the directory
# cd /usr/local/apache/conf/userdata/std/2/
4. check whether the folder named username(replace username with appropriate username) exist if not, create it.
# mkdir username
# cd username
# cd example
5. If the directory “example” is not present, create it
6. Check for the file cp_jkmount.conf here, if it is not present, create it with the following contents
——————————————–
<IfModule mod_jk.c>
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
</IfModule>
——————————————–
7. Check the file /usr/local/jakarta/tomcat/conf/server.xml Add the entry for host http://www.example.com
# vim /usr/local/jakarta/tomcat/conf/server.xml
——————————————————————————————————-
<Host name=”example” appBase=”/home/username/public_html”>
<Alias>www.example</Alias>
<Context path=”” reloadable=”true”
docBase=”/home/username/public_html” debug=”1″/>
<Context path=”/manager” debug=”0″ privileged=”true”
docBase=”/usr/local/jakarta/tomcat/server/webapps/manager”>
</Context>
</Host>
——————————————————————————————————-
8. Restart the services
# /usr/local/jakarta/tomcat/bin/shutdown.sh
# /usr/local/jakarta/tomcat/bin/startup.sh
# /scripts/restartsrv_tomcat
9. Restart Apache
No comments yet.
Leave a Reply