Viewing By Entry / Main

Railo (Resin) Apache and Mac OS X - A FAST Combination


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:

<VirtualHost *>
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
<Location /caucho-status>
SetHandler caucho-status
</Location>
</VirtualHost>

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

<host id="railo.mac">
<host-alias>railo.mac</host-alias>
<web-app id="/" root-directory="/Users/lmajano/Documents/MyDevelopment" />
</host>

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).

 

 Comments

Luis,

one small thing. The host-alias is not necessary since you define the host already with the id. The host alias is only then useful if you for instance want the url's www.myrailo.com and myrailo.com to pinpoint to the same web context.

Gert Franz
Railo Technologies GmbH
gert.franz@railo.ch
www.railo.ch

Join our Mailing List
english: http://groups.yahoo.com/group/railo_talk/
linked in: http://www.linkedin.com/e/gis/71368/0CF7D323BBC1

It's really surprising how similar this is to a regular old linux install :)

check out my entries:
http://www.garyrgilbert.com/blog/index.cfm/2008/11...
http://www.garyrgilbert.com/blog/index.cfm/2008/11...

I was trying this last week on my new MBP running Leopard and I keep getting an error after installing the apache module and starting apache.

It seems that when I compile the apache module it doesnt compile it as 64-bit so apache will not start.

Are you running the built-in Apache install for Leopard?

HI Luis,
Yeah, I'm really liking Ralo too. What's cool is that I've also isntalledl CF8 (since it runs off a different port than Railo) and then set up virtual hosts pointing to the same web root -- one that hands off requests to resin and one that doesn't -- and test the same site on CF8 and railo at the same time.

@russ

I am running the built-in apache for leopard, are you running a standalone version?

On the resin docs it mentions that apache has to be compiled with the mod_so directive.

More information can be found here:
http://caucho.com/resin/doc/install-apache.xtp

@Gert

Thanks for the pointer, I need to catch up on my resin docs, I am reading now for performance tuning.

@Gary,

First of all, it was truly nice meeting you in Germany! I read your blog and never knew it was you!! Go figure! Anyways, yes, it is very similar, just the locations are different. I had a hell of a time just figuring out that the mod_caucho.so was in the /usr/libexec/apache2 directory. I went nuts for about 1 hour finding out about it!!

@Tony,

I do the same thing, now I will be doing some load tests and see how both match up.

thanks been waiting for this

@Russ

Did you get yours figured out?
I have the default apache install & I may have the same issue as you. There were a lot of permission issues but got through those but when trying to start apache i get this in the console:

12/6/08 5:07:08 PM org.apache.httpd[8108] httpd: Syntax error on line 506 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_caucho.so into server: dlopen(/usr/libexec/apache2/mod_caucho.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_caucho.so: mach-o, but wrong architecture

@Dave,

No I havent. I have the same setup, default Apache install in Leopard and I am getting the same exact error you are.

@Russ

Ok Russ I got it.
Here is the steps
1. Downloads current Apache

2. Uncompressed it to desktop

3. I use path finder so I just went into uncompressed apache folder and opened terminal which opens up already cd'd into the directory. You could also just use terminal to cd into the directory.

4. I wanted to use the default apache locations for leopard (basically re installing over the original files). You can do this by calling the layout file when compiling and choosing the "Darwin" layout which is what leopard uses. Then run this :

./configure --enable-layout=Darwin\
--enable-mods-shared=all \
--with-ssl=/usr \
--with-mpm=prefork \
--disable-unique-id \
--enable-ssl \
--enable-dav \
--enable-cache \
--enable-proxy \
--enable-logio \
--enable-deflate \
--with-included-apr \
--enable-cgi \
--enable-cgid \
--enable-suexec

5. then run:
make

6. then run (with sudo which should allow it to write the info to the files that you are getting permission denials on):
sudo make install

Apache is now done.

Now start with Railo
Do what Luis has but when you are doing the make install do this again:
make
sudo make install

now check and see if the mod_caucho is there and then check httpd.conf to see if it added the resin code to the bottom of it.
Then do your apache virtualhost
then do your resin config
when you add the host code wrap it in server tags and i put it at the bottom like so:

<server>
<host id="railotest.site">
    <web-app id="/" root-directory="/Users/Dave/Sites/railotest" />
</host>
</server>

</resin>



the in terminal start resin(from /Applications/railo):
./bin/httpd.sh

*** NOTE
leave terminal open at this point because if you close it resin will stop
***

then browse to see railo running:
http://127.0.0.1:8600/

So next item is to keep resin running

Yes, I got it! It take me only ten minute to configure a virtual host on my Windows PC dev with this simple tutorial. More more simple than openbd, I think.

I can not install Apache. For Apache needs port 8080, but tith port busy by skype. I download instraction from http://rapid4me.com (or http://rapidpedia.com/ dont remember), but its for 8080 port. I dont want reinstall skype. What can I do ?

@susanne,

shut skype down and try to start apache again. There is an option in the skype configuration that should prevent skype from taking 8080. If not just do as I suggested and shut skype down completely (not just disconnect), then apache should start without error.

The weird thing is I use several jar files in the /Applications/railo/lib directory which aren't loading on startup at all. I have made sure the permissions were 755 so I don't think it is that. Weird thing is pretty much the entire application runs with no problems but I can't get access to the jar files.

I have railo up and running on windows box and can access these jar files no problems though which is weird. When I had CF8 install on OSX I could access them then as well.

Thoughts?

Thanks,
Jeremy

Luis,
I'm having some issues getting railo running with apache. I've followed all directions above, installation went peachy... I can access the railo admin just fine, but once I setup a vhost with apache I cannot access the local web app.
I've setup my vhost in my /etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
   ServerName dev.railo.org
   DocumentRoot "/Users/me/Sites/railo_test"
   Options Indexes FollowSymLinks MultiViews Includes
   DirectoryIndex index.cfm

   ResinConfigServer localhost 6800
   CauchoConfigCacheDirectory /tmp
   CauchoStatus yes
   <Location /caucho-status>
      SetHandler caucho-status
   </Location>
</VirtualHost>

now in my resin conf I have:

<host id="dev.railo.org">
<web-app id="/" root-directory="/Users/me/Sites/railo_test" />
</host>

I even tried wrapping my host directive with server as dave pointed out above. However when I do this resin doesn't even start.

Is there anymore configuration I have to do with resin/apache not mentioned that my be required?

thanks

In regards to my last comment, Im starting to believe it's an apache issue, because when resin starts up, I get the following:

Host[dev.railo.org] starting
[11:07:07.659] WebApp[http://dev.railo.org] starting
railo-server-root:/Applications/railo/lib/railo-server
/Applications/railo/lib/railo-server/patches/3.0.2.001.railo

WEB CONTEXT
-------------------------------------------------------------------
- config:/Users/me/Sites/railo_test/WEB-INF/railo
- webroot:/Users/me/Sites/railo_test/

so it's successfully creating the web context as defined in my config...

any thoughts?

"I even tried wrapping my host directive with server as dave pointed out above"

I wasn't saying to wrap "server" tags around it, just showing that it goes inside the server tags that are already there.

You added the site to your "hosts" file as well right?

@dave,

ack, yea I just added to my hosts file and woohoo!, it's now running!

sorry.

being a newb to apache vhosts, at least with resin, do I have to add every vhost to my hosts file?

thanks

wtg;)~
yeah you got to do it every time you add a site so it can find the right one.

Luis,

Not sure if you can help, but I'm having an issue on CentOS otherwise an identical setup to yours.

My problem:
I'm having a CentOS/ Apache/ Resin/ Railo 64 bit issue.

I got everything going on a 32 bit machine last week but I have run into a few issues on a 64 bit machine this week.

I got through the install with a few modifications but still seem to be having an issue between Apache and Resin.

I get a "Service Temporarily Unavailable" error when trying to open a test htm page. If I comment out the resin lines in httpd.conf then the test htm page will open.

Caucho status:
Configuration Cluster- localhost ok
Unconfigured Default Virtual Host

I'm kinda wondering about the Unconfigured Default Virtual Host.


Is this enough information for you to point me in the right direction?

Everything seems to be running ok otherwise.

R

I'm just seeing the comment about the hosts file. I'll try that now. I did not have to do that on the 32 bit install.

Adding it to the hosts file had no effect for me.

Hmm, it might be due to the connector and apache for 64 bit systems. Will do some research

you should always have to do that with the host file no matter what system

Is your apache running 64 bit version?

Yes Dave, we are running 64 bit Apache.

thx
Ryan

Thanks guys for this post and comments. For a guy like me who is new to Apache and Mac, this was a tremendous help.

I got everything up and running and started adding mappings and datasources to the Railo Admin, setup virtual hosts for my projects and all that fun stuff. But after a couple of days, I started getting the following error when I'd try to access the admin using http://127.0.0.1:8600/.

java.io.IOException: /Applications/eclipse/configuration/org.eclipse.osgi/bundles/515/1/.cp/content/railo-context/admin/index.cfm (No such file or directory)
   at com.aptana.ide.server.jetty.ResourceBaseServlet.doGet(ResourceBaseServlet.java:144)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
   at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
   at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
   at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
   at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   at org.mortbay.jetty.Server.handle(Server.java:324)
   at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
   at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
   at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
   at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

After some digging I found out that I needed to use my virtual host domain to access Railo admin now.
Ex: dev.myvituraldomain.com/railo-context/admin/index.cfm

Patrick,

The problem is that Eclipse has also some runtime servers for Help and whatever. Basically, they run on port 8600 and others. I would suggest you open the resin.conf file and modify the ports for the internal proxies to something else that does not conflict with eclipse. Or, just make sure you don't start eclipse first.

Luis,

That worked perfectly. I changed:
<server-default>
<!-- The http port -->
<http address="*" port="8600"/>
to port 8900 in my /Applications/railo/conf/resin.conf file:
<server-default>
<!-- The http port -->
<http address="*" port="8900"/>

Everything works as it should again. Thanks!

im trying to follow this installer, but i get this error when trying to compile the apache connector :

configure: error: no acceptable C compiler found in $PATH

how can i resolve this?

I've installed Railo. And I am delighted with it. Thank you for your advice

P.S. Yesterday I found the good torrents SE
http://www.queentorrent.com
I liked it:)

@ janusz

You need to have XCode install in order to compile the Apache connector. XCode provides the compile tools.

I went through the whole thing and got this

cp: /usr/libexec/apache2/mod_caucho.so: Permission denied

i checked my http.conf file and nothing is in there to.

anyone have any ideas?

You have to run the commands as superuser:

sudo make
sudo make install

Ok i re did it under root and it installed fine


were do i add virtual hosts so cfml pages run

Ok So i can browse to my sites and there coming up but if i hit an error i get an error about can not create dir and when i open the admin i get

can't create directory /Applications/railo/webapps/ROOT/WEB-INF/railo/cfclasses/CF_Applications_railo_webapps_ROOT_WEB_INF_railo_context10313/templates/error

also is there a way to auto start railo so i dont have to have a terminal open?

Look at the permissions on your railo folder, make sure you can read/write to it, if not, you can have problems.

As for virtual hosts, look in the apache documentation.

When I try to run configure I get this error:

/Applications/railo $ sudo ./configure --with-apxs=/usr/sbin/apxs --with-java-home=/System/Library/Frameworks/JavaVM.framework/Home
Password:
sudo: ./configure: command not found

I have xcode installed.

Here you can download anything you like.On this site, you can find anything you like http://rapiddigger.com

I am running the built-in apache for leopard, are you running a standalone version? http://filepasswords.com

I tried: ./configure --with-apxs=/usr/sbin/apxs --enable-64bit
but it says: checking build system type... i386-apple-darwin10.2.0
checking host system type... i386-apple-darwin10.2.0
checking target system type... i386-apple-darwin10.2.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... automake/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

So no C compiler?!
Any Tips?

@Reinhard

Have you got the Apple Developer tools installed? You need those to do any compilation.

Regards

Mark Drew




 


ColdBox 2.6.3 : RENEWED