server – apache mod_jk not working – Ask Ubuntu

Here is an examples of how to configure tomcat-apache connector.

You forgot JkWorkersFile directive. Add this line:

  JkWorkersFile /path/

where path is where you saved your file.

The port defined by:


is the port where is listening Tomcat. Check tomcat configuration, usually is 8009.

Source: server – apache mod_jk not working – Ask Ubuntu

server – apache mod_jk not working – Ask Ubuntu was last modified: May 28th, 2018 by Jovan Stosic

How To Encrypt Tomcat 8 Connections with Apache or Nginx on Ubuntu 16.04 | DigitalOcean

(Option 1) Proxying with the Apache Web Server’s mod_jk

The Apache web server has a module called mod_jk which can communicate directly with Tomcat using the Apache JServ Protocol. A connector for this protocol is enabled by default within Tomcat, so Tomcat is already ready to handle these requests.

Section Prerequisites

Before we can discuss how to proxy Apache web server connections to Tomcat, you must install and secure an Apache web server.

You can install the Apache web server by following step 1 of this guide. Do not install MySQL or PHP.

Afterwards, you will need to set up SSL on the server. The way you do this will depend on whether you have a domain name or not.

  • If you have a domain name… the easiest way to secure your server is with Let’s Encrypt, which provides free, trusted certificates. Follow our Let’s Encrypt guide for Apache to set this up.
  • If you do not have a domain… and you are just using this configuration for testing or personal use, you can use a self-signed certificate instead. This provides the same type of encryption, but without domain validation. Follow our self-signed SSL guide for Apache to get set up.

When you are finished with these steps, continue below to learn how to hook up the Apache web server to your Tomcat installation.

Step 1: Install and Configure mod_jk

First, we need to install the mod_jk module. The Apache web server uses this to communicate with Tomcat using the Apache JServ Protocol.

We can install mod_jk from Ubuntu’s default repositories. Update the local package index and install by typing:

  • sudo apt-get update
  • sudo apt-get install libapache2-mod-jk

The module will be enabled automatically upon installation.

Next, we need to configure the module. The main configuration file is located at /etc/libapache2-mod-jk/ Open this file now in your text editor:

  • sudo nano /etc/libapache2-mod-jk/

Inside, find the workers.tomcat_home directive. Set this to your Tomcat installation home directory. For our Tomcat installation, that would be /opt/tomcat:


Save and close the file when you are finished.

Step 2: Adjust the Apache Virtual Host to Proxy with mod_jk

Next, we need to adjust our Apache Virtual Host to proxy requests to our Tomcat installation.

The correct Virtual Host file to open will depend on which method you used to set up SSL.

If you set up a self-signed SSL certificate using the guide linked to above, open the default-ssl.conf file:

  • sudo nano /etc/apache2/sites-available/default-ssl.conf

If you set up SSL with Let’s Encrypt, the file location will depend on what options you selected during the certificate process. You can find which Virtual Hosts are involved in serving SSL requests by typing:

  • sudo apache2ctl -S

Your output will likely begin with something like this:

  • VirtualHost configuration:
  • *:80 (/etc/apache2/sites-enabled/000-default.conf:1)
  • *:443 is a NameVirtualHost
  • default server (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
  • port 443 namevhost (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
  • port 443 namevhost (/etc/apache2/sites-enabled/default-ssl.conf:2)
  • . . .

Looking at the lines associated with SSL port 443 (lines 3-6 in this example), we can determine which Virtual Hosts files are involved in serving those domains. Here, we see that both the 000-default-le-ssl.conf file and the default-ssl.conf file are involved, so you should edit both of these. Your results will likely differ:

  • sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf
  • sudo nano /etc/apache2/sites-enabled/default-ssl.conf

Regardless of which files you have to open, the procedure will be the same. Somewhere within the VirtualHost tags, you should enter the following:

<VirtualHost *:443>

    . . .

    JKMount /* ajp13_worker

    . . .


Save and close the file. Repeat the above process for any other files you identified that need to be edited.

When you are finished, check your configuration by typing:

  • sudo apache2ctl configtest

If the output contains Syntax OK, restart the Apache web server process:

  • sudo systemctl restart apache2

You should now be able get to your Tomcat installation by visiting the SSL version of your site in your web browser:

Source: How To Encrypt Tomcat 8 Connections with Apache or Nginx on Ubuntu 16.04 | DigitalOcean

How To Encrypt Tomcat 8 Connections with Apache or Nginx on Ubuntu 16.04 | DigitalOcean was last modified: May 28th, 2018 by Jovan Stosic