Blog Projects
Escape Keys
A ColdFusion and Web Development Blog by Tom de Manincor
 

I finally had the chance to install the latest Railo CFML Engine on my Centos 5.4 VirtualBox VM. I found a few good resources online, but still came across a few kinks, so I'd thought I would put together a recap including the work arounds.

Before you begin, you must have a Java 6 JDK installed. If you don't already you can get it from the Sun Java Download Page

Note the installation path. For this example, I will be using:

/opt/jdk1.6.0_17

There are a few Linux dependencies. I never like to install things I don't need, so I avoided the suggestion to install all 'Development Tools' from the Centos Add/Remove Software feature. Instead I used yum to install the noted packages. Later, adding to that list as I dealt with errors during the installation.

My compiled list so far: automake autoconf binutils gcc libtool httpd-devel openssl-devel lynx

I may have had others already installed, so if you find any that are not on the list, please post them.

Here is the command line to install them all:

yum install automake autoconf binutils gcc libtool httpd-devel openssl-devel lynx

Once yum has done it's thing and all packages have been installed or updated, our system is prepared. Let's get Railo installed.

First, we need to extract our installation package. If you haven't downloaded one already, they are available at the Railo Download Page.

For this example, I have moved the tarball into the opt directory, where I will be installing Railo.

tar -xzf /opt/railo*.tar.gz

Clean up and remove the unused files:

rm railo*.tar.gz
cd railo
rm -rf httpd.exe install-service.bat remove-service.bat setup.exe win32
cd ..

The next part is a matter of preference. You can leave the Railo folder name as is, create a symbolic link, or just rename it.

In some situations, you may require multiple versions of Railo running but prefer one as the default. Symbolic links work nice there.

ln -s railo-3(hit tab to auto complete folder name) railo

#version specific
ln -s railo-3(hit tab to auto complete folder name) railo3

Another option is a Simple rename:

mv railo-3(hit tab to auto complete folder name) railo

#version specific
mv railo-3(hit tab to auto complete folder name) railo3

Railo is now unpacked, and just needs to be integrated with Apache Web Server. It has a few scripts that do the heavy lifting. We need to configure and build the connector module Apache will use. This is where most of the earlier described linux dependencies are involved, so keep an eye out for any error messages.

cd railo3
./configure --with-java-home=/opt/jdk1.6.0_17 --with-apxs=/usr/sbin/apxs

It was mentioned to look for "checking for JNI in /opt/soft/java/include/linux ... found". That being an indicator of a successful build. Unfortunately, this is one of the areas, I had a number of errors, and even saw the correct JNI message. Hopefully, the list above of dependencies covers it, and you don't see anything unexpected here. I was able to get away with a AC_PROG_LIBTOOL undefined error. I checked to make sure libtool was installed, and it was. Everything worked beyond this point, if you see this don't be alarmed.

The next step, is to actually build the module file and have it installed with the other Apache modules. Before we can do this, we need to create a few symbolic links to take care of an installation bug.

cd /opt/railo3/modules/c/src
ln -s resin_os resin
ln -s resin_os resinssl
cd /opt/railo3

Now create the file using the distributed automake files:

make

The Apache integration is automated, as well:

make install

I had to make a few changes to my Apache configuration files, since I also have Adobe CF 8 and CF 9 running on the same machine. If you don't this will still work, and is a good practice. It keeps Railo isolated, and the more familiar you are with Apache the more you will see how flexible this approach is.

Open the Apache conf file /etc/hettpd/conf/httpd.conf. Look for the lines:

#
# mod_caucho Resin Configuration
#
LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

I created a virtual host for Railo and moved the added lines into it:

<VirtualHost *:80>
ServerName centos54r3
DocumentRoot /mnt/dev/src
LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
<Location /caucho-status>
SetHandler caucho-status
</Location>
</VirtualHost>

Keep in mind, a few of these values are specific to my setup. The ServerName and the DocumentRoot will vary.

I also added the Caucho Status location. It's a nice reference, and also a good test page.

Almost there...

Let's update our Railo instance so that it is in sync with our virtual host. Edit the /opt/railo3/conf/resin.conf. You can add your own host definitions in here, but for now I just updated the default host entry. It now points to the DocumentRoot of my Apache virtual host.

<host id="" root-directory=".">
<web-app id="/" root-directory="/mnt/dev/src"/>

One last step before we can start up the resin server. We need to add a few values to the start up script. Open up /opt/railo3/bin/httpd.sh in a text editor and add your JAVA_HOME and RESIN_HOME paths after the initial comments or anywhere before the beginning of the script.

JAVA_HOME="/opt/jdk1.6.0_17"
RESIN_HOME="/opt/railo3"

Now it's time to fire up the Resin server:

/opt/railo3/bin/httpd.sh start

To test your installation open the Admin URL from your client browser: http://virtualhostname/railo-context/admin.cfm For example, http://centos54r3/railo-context/admin.cfm

** Virtual hosts require entries in hosts file for the URLs to resolve. If you are not familiar with Virtual Hosts, please check the Apache docs.

Thanks to the Railo team for the initial resources:

Railo, Resin, Apache, and Linux PDF

Installing Railo on CentOS

I wrote an article awhile back, No More WAR, demonstrating how to set up CF 7 and 8 without using the WAR files. Instead, I used CF in stand-alone mode and Apache's Virtual Host configurations to create separate environments, that could run side by side.

I wanted to see if anything had changed with the JRun config that this technique depends on in CF 9. Fortunately, things remain the same in that department. The method is still applicable, and I am currently running: CF 7, 8, and 9 on both Linux and Windows platforms running Apache Web Server.

Why stop there? Let's add Railo 3.1 to that list. For instructions on how to integrate Railo with Apache, check out this post.

ISAPI_Rewrite 3.0 Makes It Easy For Apache and IIS

ISAPI_Rewrite is a plug-in for IIS that simulates the Apache mod_rewrite module.

The big deal about the new release, outside of performance improvements is it is now 'possible to move configurations from Apache to IIS and vice versa just by copying .htaccess files'.

Nice....No more httpd.ini for IIS and .htaccess for Apache.

Get the rest of the details from the ISAPI_Rewrite homepage.

Apache Delivers index.cfm as Plain Text

I had to post this because I couldn't find a quick answer when I Googled It.

I added index.cfm to my Apache config file under DirectoryIndex to kick off the file as a default. Which worked, kind of...When no page was specified the index.cfm was loaded. However, it was coming up in plain text. Not exactly what I am looking for here. I need that page to compile and render out with CF.

I had to add the CF extensions (.cfm, .cfml, etc.) to the AddHandler Jrun section of the Apache config file.

<IfModule mod_jrun22.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ssl false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore "C:/opt/coldfusion7/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51011
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

I am going to assume they weren't there because when I installed CF I used the built-in server method. And later, when I configured it for Apache using the Web Server Configuration Tool, I didn't check the box to configure it for Coldfusion Applications.

I've seen a few articles for setting up Coldfusion 7 and 8 simultaneously using the instance manager and deploying a WAR file.

I had heard it was possible to do it with both versions of CF in standalone mode. However, I wasn't able to find any documentation on it.

Work has me developing with Apache on an XP machine. And here we go...

Make sure you install each Coldfusion version to its own directory. For the purpose of this guide I have CF7 installed to c:\coldfusion7 and CF8 to c:\coldfusion8.

It doesn't matter which one was installed first, just remember when you are installing them you are using standalone mode, with the built in server. DO NOT ASSIGN or CONNECT to a Web Server. This prevents CF from updating your Apache config file.

** If you are already running a version of CF, you will only be installing the other version, and you don't have to worry that its already connected. Just be sure not to connect the new install, and skip the next Connector step below. **

Once you have both versions of Coldfusion installed, the next step is to connect Apache. You can use the Web Server Configuration Tool from the Start Menu, or by running wsconfig.exe in the c:\coldfusion#\runtime\bin folder. Do this for only one of the versions of CF, as doing it for both will overwrite the others' changes.

When it completes, open your Apache config file (httpd.conf) and look for a block of code like this:

LoadModule jrun_module "C:/coldfusion/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 "C:/opt/coldfusion/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51011
#JRunConfig Errorurl <optionally redirect to this URL on errors>
#JRunConfig ProxyRetryInterval 600
#JRunConfig ConnectTimeout 15
#JRunConfig RecvTimeout 300
#JRunConfig SendTimeout 15
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
</IfModule>

Keep in mind, what you see above is the default settings for your Apache Server. So if you connected CF7 then that would be your default CF version for all your current virtual hosts, unless you specify otherwise.

Which is the next step. Update your virtual host settings.

<VirtualHost *:80>
ServerName cf8testsite.local
DocumentRoot C:\wwwroot\cf8testsite
JRunConfig Serverstore "C:/coldfusion8/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51000
Alias /CFIDE C:\coldfusion8\wwwroot\CFIDE
</VirtualHost>

Notice the JRunConfig directives. They've been updated with the path to CF8 and a unique proxy port number. If you used CF8 for your default then you would be specifying the port and path to CF7. You will not choose a different port number for each virtual host. Don't get the wrong idea. That is the proxy port for CF8 here. So each Virtual Host you want to run with CF8 will get the same 2 lines added to its settings.

If you notice, the path C:/coldfusion8/runtime/lib/wsconfig/1/ doesn't exist yet. We need to create it. It's easier to copy it from the version of Coldfusion that has already been connected. The path will be the same. Copy the folder '1' over to the wsconfig folder, including the files it contains.

Don't forget the CFIDE alias. You may even need to add a DIRECTORY definition to allow access to it.

Apache is now configured and ready to go. But we're not done yet. We need to update the CF version we didn't connect to use the new port number we chose above.

Dig out the JRUN.XML file in C:\coldfusion8\runtime\servers\coldfusion\SERVER-INF\ (assuming we connected CF7) and change the proxy port to the one from above, along with activating the proxy itself:

<attribute name="deactivated">false</attribute>
<attribute name="port">51000</attribute>

Save your changes. Restart Apache and the Coldfusion Services.

Load up cf8testsite.local in a web browser, and I put a dummy index.cfm in there to dump the SERVER scope to make sure its using the version I want.

That should do it.

UPDATE (2/15/2010): If using Railo also, remove the following from the default apache confi settings and place them in the CF virtual hosts. Remember to update the path and proxy port to the appopriate versions:

AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
JRunConfig Serverstore "C:/coldfusion8/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51000

Take a look at the related articles for more information.

If you are running a VM with VMWare and using Apache, you may run into some trouble mapping your Virtual Host.

Try doubling your slashes.

For example

"\\.host\Shared Folders\My Drive"

would be