cPanel - Apache configuration for Coldfusion 9



If there is any problems in connecting Coldfusion9 with apache in cPanel Server, you have to go through the following configurations to sort out the problem.


1. SELinux must be disabled in the server.
 
   /etc/selinux/config
 
   SELINUX=disabled

2. Check jrun module is loaded with Apache. If the result of following commmand is null do the step 3 and check again.
 
   root@server [~]# httpd -M | grep jrun
   Syntax OK
   jrun_module (shared)

3. The following script is used to build jrun module.
   root@server [~]# /opt/coldfusion9/runtime/lib/wsconfig/1/build_jrun22


   In order to load jrun_module with Apache, the following entries must be added in the httpd.conf.
   Adobe ColdFusion 9 JRun Module Connector for Apache httpd.conf is as follows.
 
   --------------------------------------------------------------------------------------------------------------------------------

   # JRun Settings Start

   <IfModule prefork.c>
       LoadModule jrun_module /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so
   </IfModule>


   <IfModule mod_jrun22.c>
      JRunConfig Verbose false
      JRunConfig Apialloc false
      JRunConfig Ignoresuffixmap false
      JRunConfig Serverstore /opt/coldfusion9/runtime/lib/wsconfig/1/jrunserver.store
      JRunConfig Bootstrap 127.0.0.1:51800
      #JRunConfig Errorurl url <optionally redirect to this URL on errors>
    #JRunConfig ProxyRetryInterval 600 <no. of seconds to wait before trying to reconnect to unreachable clustered server>
      #JRunConfig ConnectTimeout 15 <number of seconds to wait on a socket connect to a jrun server>
      #JRunConfig RecvTimeout 300 <number of seconds to wait on a socket receive to a jrun server>
      #JRunConfig SendTimeout 15 <number of seconds to wait on a socket send to a jrun server>
      AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
   </IfModule>


   <IfModule mime_module>
      TypesConfig conf/mime.types
      AddType application/x-compress .Z
      AddType application/x-gzip .gz .tgz
 
      AddType application/vnd.adobe.air-application-installer-package+zip .air

   </IfModule>

   # JRun Settings End
 
  ---------------------------------------------------------------------------------------------------------------------------------


  There will be a 'mime_module' section in the httpd.conf. You just need to make sure that the following line is added in that section. If it is not there, just add those line in it.

  AddType application/vnd.adobe.air-application-installer-package+zip .air

  Note:-
  jrun module's .so file is different in different apache versions. So please note the location and name of .so file before adding it to httpd.conf file.
  The above configuration changes are based on Apache 2.x
  /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun.so (Apache 1.3.x)
  /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun20.so (Apache 2.0)
  /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so (Apache 2.x)


4. Direct modifications to the Apache configuration file may be lost upon subsequent regeneration of the configuration file.
   To have modifications retained, all modifications must be checked into the configuration system by running: /usr/local/cpanel/bin/apache_conf_distiller --update
   Create a backup copy of current httpd.conf before it.
 
   cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak

   /usr/local/cpanel/bin/apache_conf_distiller --update

   To see if your changes will be conserved, regenerate the Apache configuration file by running:
   /scripts/rebuildhttpdconf

5. There is a apache connector script used in coldfusion, /opt/coldfusion9/bin/connectors/apache_connector.sh
   It is look like as the following.
 
   --------------------------------------------------------------------------------------
   #!/bin/sh

   #
   # Configure the Apache connector.
   # -dir should be the *directory* which contains httpd.conf
   # -bin should be the path to the apache *executable*
   # -script should be the path to the script which is used to
   # start/stop apache
   #
   ../../runtime/bin/wsconfig \
   -server coldfusion \
        -ws apache \
   -dir /etc/httpd/conf \
   -bin /usr/sbin/httpd \
   -script /etc/init.d/httpd \
     -coldfusion

    exit $#
   ---------------------------------------------------------------------------------------------

   Make sure that the parameters, dir, bin and script are given as mentioned in the commented parts of the script.

   Check again jrun module is loaded with Apache.
   root@server [~]# httpd -M | grep jrun

6. Finally check colfusion binary file, /etc/init.d/coldfusion_9.
 
  .
  .
  .
  .
  CONNECTOR=""
  RUNTIME_USER=""nobody""
  JAVA_HOME="/opt/coldfusion9/runtime/jre"
  JAVA_EXECUTABLE="/opt/coldfusion9/runtime/jre/bin/java"
  DOCROOT="/usr/local/apache/htdocs"
  CF_DIR="/opt/coldfusion9"
  .
  .
  .
  .


  Note:-
  All the above configurations are based on default installation of colfusion and apache.
  If you have changed installation directory, you have to replace '/opt/coldfusion9' with the new directory.
  Here it is assumed that Coldfusion installed on /opt/coldfusion9 directory.

  You can check currently loaded apache configration using the command, httpd -V

  In a cPanel server, /etc/httpd is a symbolic link to /usr/local/apache/ so it can be used interchangeably.
  root@server [~]# ll /etc/httpd
  lrwxrwxrwx 1 root root 17 Jan  4  2011 /etc/httpd -> /usr/local/apache/

  /usr/sbin/httpd is a symbolic link to /usr/local/apache/bin/apachectl so it can be used interchangeably.
  root@server [~]# ll /usr/sbin/httpd
  lrwxrwxrwx 1 root root 31 Jan  4  2011 /usr/sbin/httpd -> /usr/local/apache/bin/apachectl*