jsp over port 80 with EasyApache and Tomcat with mod_jk does not work out of the box

Jan-Paul

Registered
Mar 24, 2015
2
0
1
Maarheeze
cPanel Access Level
Root Administrator
Hello,
I have a CentOS 6.6 VPS with WHM/Cpanel and I have followed the instructions at https://forums.cpanel.net/threads/cpanel-tomcat-jsp-and-servlets-guide.282922/ to install EasyApache (2.2.29) with Tomcat 7.

After this I added an account and installed servlets on this account using WHM > Account Functions > Install Servlets.

Now the testjsp.jsp is only available at http://www.domain.com:8080/testjsp.jsp and not at http://www.domain.com/testjsp.jsp

My question is simple: What do I need to do to make the testjsp.jsp visible at http://www.domain.com/testjsp.jsp?
 
Jun 18, 2015
16
4
3
Maarheeze
cPanel Access Level
Root Administrator
I asked the guys from cPanel for help and the support bloke came to a conclusion that my firewall (iptables) blocked port 8009. I stopped the firewall on the command line:

/etc/init.d/iptables save
/etc/init.d/iptables stop
/sbin/chkconfig --del iptables

And after that the testjsp.jsp page was available through port 80.

After that I installed CSF (without restarting iptables, I let CSF do that) with:

wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

Then I configured port 8009 in WHM > Plugins > CSF. Now it all works perfectly.

So for recap, the most important is to:
- install EasyApache + Tomcat7;
- install servlets for your domain via WHM > Account functions > Install servlets;
- adjust iptables (not very easy, I recommend using CSF) to make port 8009 listen for requests.

That is the most important bit to make it all work.

After that you can let Apache know which webfolder needs Tomcat by adjusting the files:

/usr/local/apache/conf/userdata/std/2/$user/$domain/cp_jkmount.conf

and

/usr/local/apache/conf/userdata/ssl/2/$user/$domain/cp_jkmount.conf

An example (in my case for the use of XWiki) of such a file is:

<IfModule mod_jk.c>
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /xwiki/* ajp13

</IfModule>

I hope this can be of help to someone.
 
Last edited:
  • Like
Reactions: Ana Angel