Installing Railo + Apache in Mac OSX

This step by step guide is to show you how to install Railo and create a connector to Apache in Mac OS X. I am now using Railo as my development environment due to its speed and strict coding that I can assign to it. This makes sure that every ColdBox release is what it is supposed to be. I am still amazed at how fast and stable Railo is and I highly encourage you to give it a shot!

Anyways, now for the fun.

1) Download Railo from http://railo.ch/en/index.cfm?treeID=224

I downloaded the All OS download: railo-3.0.1.000-resin-3.1.2-without-jre.zip (39 MB)

Once downloaded I unpacked it and installed it in


/Applications/railo

2) Remove some windows files, because I am a cleanup freak.


rm -rf httpd.exe setup.exe win32

3) Let’s compile the apache connector by following these commands, but first cd into the Railo directory via your terminal.


$ cd /Applications/railo
$ ./configure --with-apxs=/usr/sbin/apxs --with-java-home=/System/Library/Frameworks/JavaVM.framework/Home

Update:
For java in 64 bit mode (snow leopard or leopard), use the following command:
./configure –with-apxs=/usr/sbin/apxs –enable-64bit

This should spurt out a long list of compilation checks and please look at my java home as my default jvm in my Mac. Once it finishes it should finish with the following:


configure: creating ./config.status
config.status: creating Makefile
config.status: creating modules/c/src/Makefile
config.status: creating modules/c/src/common/Makefile
config.status: creating modules/c/src/apache1/Makefile
config.status: creating modules/c/src/apache2/Makefile
config.status: creating modules/c/src/resin_os/Makefile
config.status: creating contrib/init.resin
config.status: executing depfiles commands

This means we are done. So now let’s make and install the mod_caucho.so connector.


$ make
$ make install

After this, you should be A-OK. The script will copy mod_caucho.so to /usr/libexec/apache2/mod_caucho.so and modify your apache conf with


#
# mod_caucho Resin Configuration
#

LoadModule caucho_module /usr/libexec/apache2/mod_caucho.so

ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

Now it is up to you if you want to configure specifc virtual hosts to use resin or not. Example:



ServerName railo.jfetmac
DocumentRoot /Users/lmajano/Documents/MyDevelopment/
Options Indexes FollowSymLinks MultiViews Includes
DirectoryIndex index.html index.htm login.cfm index.php index.cfm

ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

SetHandler caucho-status


Now we open the /Applications/railo/conf/resin.conf and add a few aliases that map our web application to apache:



railo.mac


After that just fire up apache and the resin server by running:


/Applications/railo/bin/httpd.sh

After that, the server runs and your application is up and running!!

Update
Some people have not been able to compile mod_caucho because Apache is running in 64bit mode and the caucho mod is 32 bit mode. Here is some extra help for you:

Here’s how to change your apache to run in 32 bit mode.

From Adobe.com
———————————————
To switch Apache from running in 64-bit to 32-bit on Mac OS X 10.5, do the following:

1. Go to /usr/sbin and make a backup of httpd (for example,
httpd.back).
2. Run the following command from the terminal:

sudo lipo httpd -thin i386 -output httpd

3. To confirm the resulting http architecture, from /usr/sbin, run
the following command:

file httpd

4. The file command should give httpd:Mach-O executable i386.
5. Restart Apache by running the following command:

sudo ./apachectl restart

6. The conf file (httpd.conf) location remains the same
(/etc/apache2).