Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Configuring Apache with JK Connector

Configuring Apache with JK Connector

This section explains how to set up the Apache server with the JK Connector (mod_jk) module for load balancing.

  1. Download and install the JK Connector from http://www.apache.org/dist/tomcat/tomcat-connectors/jk/.
  2. We recommend downloading the source code and building the connector based on the instructions in BUILD.txt:
    $ cd native
    $ ./configure --with-apxs={APACHE_HOME}/bin/apxs
    $ make
    $ make install
    
  3. Add the following at the end of the APACHE_HOME\conf\httpd.conf file:
    # Include mod_jk's specific configuration file
    Include conf/mod-jk.conf
    
  4. Create a new file named APACHE_HOME\conf\mod-jk.conf with the following:
    # Load mod_jk module
    # Specify the filename of the mod_jk lib
    LoadModule jk_module modules/mod_jk.so
    
    # Where to find workers.properties
    JkWorkersFile conf/workers.properties
    
    # Where to put jk logs
    JkLogFile logs/mod_jk.log
    
    # Set the jk log level [PD:debug/error/info]
    JkLogLevel info
    
    # Select the log format
    JkLogStampFormat  "[%a %b %d %H:%M:%S %Y]"
    
    # JkOptions indicates to send SSK KEY SIZE
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    
    # JkRequestLogFormat
    JkRequestLogFormat "%w %V %T"
    
    # Mount your applications
    JkMount /* loadbalancer
    
    # You can use external file for mount points.
    # It will be checked for updates each 60 seconds.
    # The format of the file is: /url=worker
    # /examples/*=loadbalancer
    JkMountFile conf/uriworkermap.properties
    
    # Add shared memory.
    # This directive is present with 1.2.10 and
    # later versions of mod_jk, and is needed for
    # for load balancing to work properly
    JkShmFile logs/jk.shm
    
    # Add jkstatus for managing runtime data
    <Location /jkstatus/>
        JkMount status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>
    
  5. Create a new file named APACHE_HOME\conf\workers.properties with the following lines. Replace SF1_SERVER_IP and SF2_SERVER_IP with the IP addresses of the servers that will be the nodes in the cluster.
    # Define list of workers that will be used
    # for mapping requests
    worker.list=loadbalancer,status
    
    # Define Node1
    # modify the host as your host IP or DNS name.
    worker.node1.port=8009
    worker.node1.host={SF1_SERVER_IP}
    worker.node1.type=ajp13
    worker.node1.lbfactor=1
    worker.node1.cachesize=100
    
    # Define Node2
    # modify the host as your host IP or DNS name.
    worker.node2.port=8009
    worker.node2.host={SF2_SERVER_IP}
    worker.node2.type=ajp13
    worker.node2.lbfactor=1
    worker.node2.cachesize=100
    
    # Load-balancing behaviour
    worker.loadbalancer.type=lb
    worker.loadbalancer.balance_workers=node1,node2
    worker.loadbalancer.sticky_session=1
    
    # Status worker for managing load balancer
    worker.status.type=status
    

For more information on the JK Connector, see http://tomcat.apache.org/connectors-doc/index.html.