Home > Apache, Apple/ MAC, ColdFusion, Railo, Tomcat > How to configure Railo – Tomcat – Apache on MAC Lion Mountain 10.8

How to configure Railo – Tomcat – Apache on MAC Lion Mountain 10.8

Last week I updated my operating system from Snow Leopard  to Lion Mountain 10.8, system has upgraded itself.

Only two problems I faced:

1) Little Snitch got removed (V 2.2), I had to buy Licence for upgrade of version 3.02 – Lion cost me more 😦

2) I had ColdFusion 9.01, which stopped working as Lion upgrade had reinstalled Apache removed old httpd.conf and httpd-vhost.conf files (actually renamed them as httpd.conf~previous.

I tried to move virtual sites from old to new but it didn’t work.

Web Sharing option got removed from System Preference – To get it back I found this post which provides a tool to get it in Sys Pref under Other:

Explanation, good article to read: Restore Web Sharing in Mountain Lion 

Get the tool from here: WEB SHARING IN OS X MOUNTAIN LION

I made few changes to Apache config files, by default it uses web server document folder here:

/Library/WebServer/Documents

I have changed this and few other settings in httpd.conf (/private/etc/apache2/)

1) Find ServerAdmin and change email address to yours one (around line no 153)

2) Find ServerName and change it to cfdev also add following in hosts file (/private/etc/)

127.0.0.1 cfdev  (now you can get to your webserver by localhoost/ cfdev/ 127.0.0.1)

Make sure you uncomment this line (at line no 481) Include /private/etc/apache2/extra/httpd-vhosts.conf

3) create a folder sites or whatever name you waant to give at root level

4) Find DocumentRoot (line no 169) and change it to “/sites”

5) Find < Directory and change it with “/sites”

6) Open file httpd-vhost.conf from /private/etc/apache2/extra/

7) Uncomment NameVirtualHost *:80 (Line no 19)

8) Add following virtual host (default) site

<VirtualHost *:80>
DocumentRoot “/sites”
ServerName cfdev
DirectoryIndex index.html

</VirtualHost>

9) Add / Create index.html in /sites folder as a place holder

10) sudo apachectl restart (to pick-up the changes

now open browser and browse http://cfdev or http://localhost and you should see your default web page

Railo Installation:

Download your railo installer from here

Scroll down and pick MacOS installer infront of Railo Server with Tomcat 7 title

Open it up and follow the default steps:

It will normally Install under this location and picks port 8080 – /Library/Railo/tomcat/

now if you browse http://localhost:8080/ you should see the tomcat page

1) Open web.xml from tomcat/conf folder

Add following at around line 422 (This will help if you use CFWheels frame-work

<servlet-mapping>
<servlet-name>GlobalCFMLServlet</servlet-name>
<url-pattern>/rewrite.cfm/*</url-pattern>
</servlet-mapping>

2) Open server.xml from tomcat/conf

3) go to line no 90 and un comment following:

<Connector port=”8009″ protocol=”AJP/1.3″ redirectPort=”8443″ />

This will help us to use apache server on port 80 to create virtual sites.

at around line 123 you will see default website for this Tomcat server

create a folder under /sites folder – which will be your first local site say – firstSite

inside the folder create index.cfm

now create a virtual site in server.xml like this: (above </Engine>)

<Host name=”dev.firstsite.com” appBase=”webapps”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”/sites/firstSite”/>
</Host>

save the file and restart the server (Tomcat):

4) open terminal window and go to /Library/Railo/tomcat/bin

run following command: sudo sh shutdown.sh (to shutdown the server)

Now run this command to start it: sudo sh startup.sh

5) add following in hosts file: 127.0.0.1 dev.firstsite.com

now browse http://dev.firstsite.com:8080 and you will see your first site index.cfm running

6) open httpd.conf from /private/etc/apache2/

add following (Thanks to Anuj Gakhar this post)

<Proxy *>
Allow from 127.0.0.1
</Proxy>

ProxyPreserveHost On
ProxyPassMatch ^/flex2gateway/(.*)$ ajp://localhost:8009/flex2gateway/$
ProxyPassMatch ^/messagebroker/(.*)$ ajp://localhost:8009/messagebroker/$1
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2

now open httpd-vhosts.conf from /apache2/extra/ folder and add virtual site (key to this set up is you need to add virtual site pointing to the same folder with same url under both servers)

<VirtualHost dev.firstsite.com>
DocumentRoot /sites/firstSite
DirectoryIndex index.cfm
<Directory “/sites/firstSite”>
AllowOverride All
Order allow,deny
Allow from all
Options +Indexes
</Directory>
ErrorLog firstsite.error.log
LogLevel warn
</VirtualHost>

restart your apache server and

browse http://dev.firstsite.com  and you should see your site running on port 80

 

Advertisements
  1. June 9, 2013 at 3:44 am

    I am just getting into railo but I have used adobe server the past 9/10 years. Was looking to host just some cf pages/projects I’ve done over the years to showcase portfolio. I’m using snow leopard and got as far as step 5 and site dev.firstsite.com didn’t come up. I am currently running wp site and learning the ins and outs of my first home server so adding various pieces together. I tried to follow along but ran into some problems, would you happen to know any resources dealing with snow leopard and not installing xcode? Railo worked just fine until I got in and started adjusting things

  2. April 7, 2013 at 8:27 pm

    thank you so much!

    • April 7, 2013 at 9:51 pm

      you are welcome 🙂

  3. Richard Herbert
    January 23, 2013 at 9:47 am

    I alway have all my Apache customisations, including vhosts and anything the ColdFusion installer adds, in a separate file and “Include” it in the foot of the Apache httpd.conf file. That way all is not lost if Apple deletes the httpd.conf file. I’ve also started to have separate conf files for ACF and Railo and switch between them as required.

    On the point of having to “mirror” vhost settings in the Tomcat server.xml, take a look at http://www.modcfml.org/ as a possible solution. I’ve not implemented it yet but it looks promising.

    • January 23, 2013 at 9:53 am

      Thanks Richard 🙂

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: