Search code examples
javalinuxtomcatpleskmod-jk

Tomcat, mod_jk, Plesk and SSL setup problems


my workers.properties:

vi /etc/httpd/conf.d/workers.properties
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

my mod_jk.conf

vi /etc/httpd/conf.d/mod_jk.conf
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkShmFile     /var/log/httpd/mod_jk.shm
JkLogFile     /var/log/httpd/mod_jk.log
JkLogLevel    info
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

Added to Tomcat server.xml

<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
<Host name="domain.com" appBase="/opt/tomcat/webapps/">
<Context path="" docBase="domain-dir"/>
<Alias>www.domain.com</Alias>
</Host>

added mod_jk entries in plesk domain name as under:

vi /var/www/vhosts/system/domain.com/conf/vhost.conf
<IfModule mod_jk.c>
JkMount /servlet/* worker1
JkMount /*.jsp worker1
</IfModule>

Till here things started towards working but tomcat was redirecting to apache on port 80 whilst its using port 8443 for all hosted domains.

Then I tried to add SSL via java keytool utility and added the following into tomcat server.xml

<Connector port="8445" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="/opt/tomcat/ssl/keytool.jks" keystoreType="JKS" keystorePass="pass"/>

The error was ajp cannot be initialized as address is already in use. I think the reason was port 8443 is used by Plesk. Then I changed port 8443 as 8445 and tomcat start working as https but with some error obviously because of self signed certificate.

Still not able to fix the problem(s):

http://domain.com --> working enter image description here

https://domain.com --> not working enter image description here

https://domain.com:8445 --> Rendering servlet pages but not pages from http (Apache) on Plesk enter image description here

  1. Why tomcat working fine with Plesk http pages and not working with HTTPS pages?
  2. Why tomcat request is not going to https domains of Plesk
  3. Plesk is occupied 8443 port for displaying domains and 443 for devcot.
  4. I don't know where I am making mistake as this 4th day I am clueless and finally decided to get help here in this forum

Please advise


Solution

  • Do you want to Access the application via HTTPS in Apache httpd? If yes then please add all JKmount entry in Apache httpd SSL VirtualHost.

    JkMount /servlet/* worker1
    JkMount /*.jsp worker1