5.2.2. Connecting via AJP protocol

As described above, the 'glue' method can be implemented via one of the following ways:

With the first method, you only need the HTTP daemon and application server, but settings are limited.

With the second method, you can obtain more settings, but you will need to download and install additional modules for the HTTP Daemon that are not included in the default package.

AJP proxy module

Make sure that mod_proxy_ajp.so is included in the list of loadable modules. Add the following to your virtual host configuration setting:

ProxyPass / ajp://localhost:8009/

In this example, the app server is located on the same host as the Apache HTTP daemon, and accepts incoming connections on the port 8009 (the default setting for the Tomcat application server). You can find the full list of virtual host configurations here:

<VirtualHost *:80>
  ServerName      Enter your server DNS name here
  ProxyRequests   Off
  ProxyPass / ajp://localhost:8009/
</VirtualHost>

Apache Tomcat's AJP connector

  1. Download the AJP connector module here.

  2. Move the downloaded mod_jk.so file to the HTTPD's module directory, for example /etc/httpd/modules. The directory may be different, depending on the OS.

  3. Create the configuration file for the mod_jk.conf module.

    LoadModule    jk_module  modules/mod_jk.so
    <IfModule jk_module>
      # ---- Where to find workers.properties
            JkWorkersFile   conf.d/workers.properties
      # ---- Where to put jk logs
      JkLogFile       logs/mod_jk.log
      # ---- Set the jk log level [debug/error/info]
      JkLogLevel    info
      # ---- Select the timestamp log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
      JkRequestLogFormat "%w %R %T"
      # ---- Send everything for context /examples to worker named worker1 (ajp13)
      JkMountFileReload       "0"
    </IfModule>
    

    Note

    For more details, see the Tomcat documentation.

  4. Place the mod_jk.conf file into the directory where other configuration files for Apache HTTP daemon are located, for example /etc/httpd/conf.d/.

  5. Create the workers.properties file, which defines the AJP workers for the HTTP daemon.

    worker.list=status, WORKER_NAME
    # Main status worker
    worker.stat.type=status
    worker.stat.read_only=true
    worker.stat.user=admin
    # Your AJP worker configuration
    worker.WORKER_NAME.type=ajp13
    worker.WORKER_NAME.host=localhost
    worker.WORKER_NAME.port=8109
    worker.WORKER_NAME.socket_timeout=120
    worker.WORKER_NAME.socket_keepalive=true
    

    Note

    In the example above, you can change WORKER_NAME to any value.

  6. Put this file in the same directory as the mod_jk.conf file.

  7. Update the virtual host configuration.

    <VirtualHost *:80>
      ServerName      Enter your server DNS name here
      ProxyRequests   Off
      JkMount         /*  WORKER_NAME
    </VirtualHost>
    

Note

If you are using Platform Tomcat, an AJP connector is enabled already. However, in Platform JBoss, you need to configure one, as described below.

In Platform JBoss, you need to modify the $PLATFORM_JBOSS_HOME/standalone/configuration/standalone-exo.xml file (standalone-exo-cluster.xml in cluster mode).

Find the subsystem urn:jboss:domain:web:1.5 section and add the connector:


<subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="default-host" native="false">
    ...
    <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
    ...
</subsystem>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus