Installation OSXLionServer - getrailo/railo GitHub Wiki

Table of Contents

Installing Railo on OS X Lion Server

Installing Railo on OS X Lion Server is very similar to installing Railo Server on any other version of OS X. There are a few pre-requisites though, which you might already have installed, but I am documenting here for completeness. These are:

  1. Java
  2. OS X Lion Server (which you can download from the App store)
  3. Railo Server OS X Installer from http://www.getrailo.org
Let's get started!

Checking the install

First off let's see what we have, running the Server application, and clicking on the "Web" section shows that the server isn't running yet, so you should switch that on:

The next task is to make sure Java is installed. The easiest way to do this is open the Terminal Application (under /Applications/Utilities) and type

>java

This will start the installation process (despite getting an error in the terminal screen) and OS X will install Java for you:

Once the process is complete, you can check your java version by typing in the following:

>java -version

Which should display the version of java that has just been installed:

Great, now we are ready to install Railo Server!

Installing Railo Server

Most of the install process of Railo Server is just a matter of clicking "Next" for each step, having said this, there are a few times where the default isn't correct in this case. I shall go over it and explain the process and explain the caveats.

Unzip and run the installer:

When you are asked where you want to install it, leave it as the default of /Library/Railo (of course, remember this location!)

Next you are asked for the username for the TOMCAT manager, this is part of Tomcat and not Railo Server:

Next add the password for the tomcat manager (This will also set the Railo Server Administrator password for you, handy eh?):

The installer will ask you which port you want Tomcat to listen to requests on, by default 80, but if you leave this setting:

You will get an error since you are already running a web server:

Change the port to something else, for example 8080:

Since we don't want to have to start tomcat manually, we can ask the installer to start Railo Server automatically for us, whenever the server is turned on:

If you like you can install a Fusion Reactor trial (for this example we won't go into this):

And now the installer will go and install Railo Server for us:

Testing the install

Once the installer has finished, it will ask you to go to the administrator, clicking ok you should get the following page:

And then entering the password we used in the installer we see:

Setting tomcat to respond to Localhost

Tomcat will deliver documents out of the box from it's own folder, for example /Library/Railo/tomcat/webapps/ROOT/, which is of course NOT where Apache is delivering documents from.

This is important:

For every domain you are serving, you need to tell both Railo Server (in the server.xml) and Apache which folders to serve code from

Got it? So if you add a new virtual host to Apache, you also need to add it to Tomcat. This is the first mistake that people make. We are going to look at this later, but for now, if you we go to http://localhost:8080/ we are going to be serving pages from /Library/Railo/tomcat/webapps/ROOT/ rather than /Library/Server/Web/Data/Sites/Default, which is the default for Apache on OS X Lion Server.

Let's change this first for Tomcat, edit the file /Library/Railo/tomcat/conf/server.xml and find the following code, which tells where we are serving files from currently:

And change it (there is a handy comment below that to give you a reference) to :

Now, for the changes to have some effect we need to restart Tomcat, so run the following:

> cd /Library/Railo/tomcat/bin/
> sudo ./shutdown.sh

This stops the Tomcat server, and now let's start it again:

> sudo ./startup.sh

Now if we go to http://localhost:8080 we get an error but it tells us where we are serving from:

If we browse to the default document location you will see that a WEB-INF folder has been created:

Great! Now Tomcat is serving from the right directory!

Adding an index.cfm with a simple output in that folder (such as the script below)

<cfoutput>#Now()#</cfoutput>

Will show that everything is working through Tomcat:

Finally connecting Apache to Tomcat

Of course, you don't want to be serving stuff through port 8080, since no one does that! Let's connect Apache up to Tomcat, easily and get it running:

Open up /etc/apache2/httpd.conf in your favourite editor and add the following line somewhere near the bottom (I have added a screenshot so you can see line numbers, your lines numbers may vary of course):

#Connect to tomcat
Include /private/etc/apache2/httpd_tomcat.conf

Now create the file called httpd_tomcat.conf and put the following lines:

ProxyRequests Off
<Proxy *>
	Order deny,allow
	Allow from all
</proxy>
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

Alternatively, you can also just filter CFM/CFC requests to Tomcat:

<Proxy *>
	Allow from 127.0.0.1
</proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2

This will now proxy ALL requests to the localhost domain on Tomcat...Remember what I said about tomcat responding to domains? This means that you can have a domain called www.myawesomedomain.com in Apache but it will be proxied to the localhost domain on tomcat.

Now we can restart apache, so that the changes take effect by running:

sudo apachectl restart

(as a note, I haven't tried just switching it on and off again in the Server app, it might work, but I was just making sure.

And finally, we can now access http://localhost/index.cfm and get our script running!

⚠️ **GitHub.com Fallback** ⚠️