To set up mod_jk, follow these steps:
Obtain the following software:
Apache 2.0.x
Apache Tomcat Connectors (http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/)
Apache Tomcat 5.5.16, needed for just one JAR file (http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.16/bin/apache-tomcat-5.5.16.tar.gz)
Apache Commons Logging 1.0.4 (http://archive.apache.org/dist/jakarta/commons/logging/binaries/commons-logging-1.0.4.tar.gz)
Apache Commons Modeler 1.1 (http://archive.apache.org/dist/jakarta/commons/modeler/binaries/modeler-1.1.tar.gz)
Install mod_jk as described at http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html.
Copy the following Tomcat and Jakarta Commons files to as-install/lib:
tomcat-ajp.jar
commons-logging.jar
commons-modeler.jar
Create and configure the following files:
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/worker.properties or domain-dir/config/glassfish-jk.properties (to use non-default values of attributes described at http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html)
Examples of these files are shown after these steps. If you use both worker.properties and glassfish-jk.properties files, the file referenced by httpd.conf, or referenced by httpd.conf first, takes precedence.
Start httpd.
Enable mod_jk using the following command:
asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009 |
If you are using the glassfish-jk.properties file and not referencing it in httpd.conf, point to it using the following command:
asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK.propertyFile=domain-dir/config/glassfish-jk.properties |
Restart the Enterprise Server.
Here is an example httpd.conf file:
LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so JkWorkersFile /etc/httpd/conf/worker.properties # 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
Here is an example worker.properties or glassfish-jk.properties file:
# Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost.localdomain worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300