Home  |  Contact         

Zrinity is the leader in enterprise-class email marketing management solutions and content management solutions for marketing professionals and developers worldwide.
Home What We Offer Solutions Services Resources Company
Compiling and Installing the Apache module for CFMX from source code

This example was tested on a server running Redhat Linux 8 and Apache 2.0.46 built from source. Click on the link for instructions on installing from source.

Install updater 3 or greater
The source code for the ColdFusion Apache module was included in CFMX updater 3, so step one is to install Updater 3 or higher from Macromedia. In this particular case CFMX was already installed using the standalone server, so if your are installing from scratch choose that option.

Extract the module source code
The source is located in the coldfusionmx/runtime/lib/ directory inside the wsconfig.jar file. Jar files are Java Archive files, and they use the same compression as zip files, so you can treat them like zip files.

 cp /opt/coldfusionmx/runtime/lib/wsconfig.jar .
 unzip wsconfig.jar

This creates several directories but in connectors/src/ the source for the Apache module resides. Unzip the file ApacheModule.zip

 cd connectors/src
 unzip ApacheModule.zip

Compile the Apache Module
In the src directory is a file called ApacheBuildInstructions.txt, read this file. This file is the basis of our instructions for this step.

 cat ApacheBuildInstructions.txt 
We have crafted a build script that does most of the work for you, you just need to make sure the the paths are correct in the build script:

#CFMX path eg: /opt/coldfusionmx
export CFMX=/opt/coldfusionmx

#apache path eg: /usr/local/apache2
export APACHE_PATH=/usr/local/apache2

#apache bin path eg: $APACHE_PATH/bin

#CFMX connector path eg $CFMX/runtime/lib/wsconfig/1
export CFMX_CONNECTOR=$CFMX/runtime/lib/wsconfig/1

#stop apache
$APACHE_BIN/apachectl stop

${APACHE_BIN}/apxs  -c  -Wc,-w -n jrun20 -S LIBEXECDIR=${CFMX_CONNECTOR}  mod_jrun20.c \
                jrun_maptable_impl.c  jrun_property.c  jrun_session.c platform.c \
                jrun_mutex.c  jrun_proxy.c  jrun_ssl.c

${APACHE_BIN}/apxs -i -n jrun20 -S LIBEXECDIR=${CFMX_CONNECTOR} mod_jrun20.la

strip   $CFMX_CONNECTOR/mod_jrun20.so

Before you run this script (note: you can also just type it in by hand) make sure that the directory for the CFMX_CONNECTOR exists (runtime/lib/wsconfig/1). You will probably need to make this directory:

 mkdir /opt/coldfusionmx/runtime/lib/wsconfig/1

If the directory already exists create a directory called 2 instead of 1, and update the CFMX_CONNECTOR variable in the script. Now save the script above in a file, we assume you called it build.sh. You need to mark it as executable with chmod, and then run it.

 chmod u+x build.sh

Now you have built the mod_jrun20.so file, and it resides in your CFMX_CONNECTOR directory.

Configure ColdFusion MX to work with Apache First stop ColdFusion MX:

 service coldfusionmx stop

Now edit the file /opt/coldfusionmx/runtime/servers/default/SERVER-INF/jrun.xml it may be a good idea to keep a backup of this file before you edit it. Below is the settings you will want to change, with changes in Bold (approx line 350):
<service class="jrun.servlet.http.WebService" name="WebService">
    <attribute name="port">8500</attribute>
    <attribute name="interface">*</attribute>
    <attribute name="deactivated">true</attribute>
    <attribute name="activeHandlerThreads">10</attribute>
    <attribute name="minHandlerThreads">10</attribute>
    <attribute name="threadWaitTimeout">300</attribute>
    <attribute name="maxHandlerThreads">1000</attribute>

<service class="jrun.servlet.jrpp.JRunProxyService" name="ProxyService">
    <attribute name="port">51010</attribute>
    <attribute name="deactivated">false</attribute>
    <attribute name="activeHandlerThreads">10</attribute>
    <attribute name="minHandlerThreads">10</attribute>
    <attribute name="threadWaitTimeout">300</attribute>
    <!-- set this to false for multi-hosted sites -->
    <attribute name="cacheRealPath">false</attribute>
    <attribute name="maxHandlerThreads">500</attribute>
    <attribute name="mapCheck">0</attribute>
The cacheRealPath attribute may be left to true if your only running one web site on the apache server, but if you are running multiple sites you will want to set it to false.

Configure apache for ColdFusion
The Apache httpd.conf file needs to be told to load the module, and also told that index.cfm should be used as a directory index. To accomplish this, I like to create a directory called conf.d in my apache directory /usr/local/apache2/conf.d/ and then create a file called coldfusion.conf. If I have other modules such as php, I create a php.conf file. This allows you to easily edit module specific settings. So to do this I need to tell httpd.conf about my conf.d directory, I do this by adding the following line to the httpd.conf file:

 Include conf.d/*.conf
you will want to make sure that your httpd.conf file does not already have this line in it, to search your file run:

 grep conf.d httpd.conf
It will not output anything if it does not find the string conf.d in httpd.conf

Now lets create conf.d/coldfusion.conf with the following contents:

 LoadModule jrun_module "/opt/coldfusionmx/runtime/lib/wsconfig/1/mod_jrun20.so"
 <IfModule mod_jrun20.c>
    JRunConfig Verbose false
    JRunConfig Apialloc false
    JRunConfig Ssl false
    JRunConfig Ignoresuffixmap false
    JRunConfig Serverstore "/opt/coldfusionmx/runtime/lib/wsconfig/1/jrunserver.store"
    JRunConfig Bootstrap
    #JRunConfig Errorurl optionally redirect to this URL on errors
    AddHandler jrun-handler .cfm .cfc .cfml .jsp .jws

 DirectoryIndex index.cfm

Start ColdFusion and Apache

 service coldfusionmx start
 service apache start

Note: the service command is located at /sbin/service on Redhat 8, it runs the respective /etc/init.d/ startup script. If it is not in your path run source /etc/profile

home products services partners company support contact
Copyright 2020 © Zrinity Inc. All rights reserved.     View our privacy policy         July 7, 2020