28 Apr 2011
If at First You Dinnae Succeed...
“Embedded Ruby with Nginx”

For about three days in a row over this [alleged!] holiday, I’ve been wrestling with my webserver, trying to configure it so I could use embedded Ruby in my webpages. Something I’ve been meaning to do, ever since I switched from using Apache to Nginx for my server, a while back.

The consensus of web-wisdom suggested that the easiest way to do this was the allegedly “plug’n’play” Phusion Passenger. So I spent about two-and-four-fifths of those three days, configuring, reconfiguring, uploading, downloading, installing, uninstalling Ruby, Nginx, Passenger and various other doohickeys and doodads and must have tried every configuration option out there, with absolutely no result; whatever I did, Nginx, Passenger and Ruby steadfastly refused to even look at each other.

Then, yesterday evening, I came across this pair of articles on Slicehost, walking through installing a separate server called Thin [which I’d never heard of before], to run alongside Nginx and then configuring Nginx to hand off any requests for pages containing Ruby code to Thin:

While ploughing the depressing Passenger furrow, I’d seen a couple of recommendations from people suggesting the best way to use Ruby and Nginx together was this twin-server setup, but I figured that --since setting up and configuring one server provides enough headaches to keep me occupied in my spare time-- setting up two servers and expecting them to skip along hand-in-hand in perfect harmony, was just asking for trouble.

However, having exhausted the alleged ‘easy’ option, I had nothing left to lose, so I thought I’d give it a go.

Approximately 45mins later I had Nginx and Thin, effortlessly passing Ruby embedded pages back and forth between them, with the dexterity of circus jugglers.

Go me!

AUDIENCE: So what’s the feckin’ moral of this story then, you boring nerd?

STÍO: The moral of the story, Glasshoppa’ is "`Sometimes path least travelled is quickest route to destination`"

Back to Top