Sun GlassFish Enterprise Server v3 Administration Guide

ProcedureTo Enable mod_jk

You can front Enterprise Server with Apache HTTP Server by enabling the mod_jk protocol for one of Enterprise Server's network listeners, as described in this procedure. A typical use for mod_jk would be to have Apache HTTP Server handle requests for static resources, while having requests for dynamic resources, such as servlets and JavaServerTM Pages (JSPs), forwarded to, and handled by the Enterprise Server back-end instance.

When you use the jk-enabled attribute of the network listener, you do not need to copy any additional JAR files into the /lib directory. You can also create JK connectors under different virtual servers by using the network listener attribute jk-enabled.

  1. Install Apache HTTP Server and mod_jk.

  2. Configure the following files:

    If you use both the file and the file, the file referenced by httpd.conf first takes precedence.

  3. Start Apache HTTP Server (httpd).

  4. Start Enterprise Server with at least one web application deployed.

    In order for the mod_jk–enabled network listener to start listening for requests, the web container must be started. Normally, this is achieved by deploying a web application.

  5. Create an HTTP listener by using the create-http-listener(1)subcommand.

    Use the following format:

    asadmin> create-http-listener --listenerport 8009 
    --listeneraddress --defaultvs server listener-name

    where listener-name is the name of the new listener.

  6. Enable mod_jk by using the set(1) subcommand.

    Use the following format:

    asadmin> set

    where listener-name is the ID of the network listener for which mod_jk is being enabled.

  7. If you are using the file and not referencing it in the httpd.conf file, point to the properties file by using the create-jvm-options(1) subcommand.

    Use the following format:

    asadmin> create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK.propertyFile=
  8. To apply your changes, restart Enterprise Server.

    See To Restart a Domain.

Example 6–4 httpd.conf File for mod_jk

This example shows an httpd.conf file that is set for mod_jk.

LoadModule jk_module /usr/lib/httpd/modules/
JkWorkersFile /etc/httpd/conf/
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send all jsp requests to GlassFish
JkMount /*.jsp worker1
# Send all glassfish-test requests to GlassFish
JkMount /glassfish-test/* worker1

Example 6–5 File for mod_jk

This example shows a or file that is set for mod_jk.

# Define 1 real worker using ajp13
# Set properties for worker1 (ajp13)

See Also

For more information on Apache, see

For more information on Apache Tomcat Connector, see