As a part of a New Year's resolution I started learning Ruby on Rails (it was more than 5 years since I last picked up a new programming language!). Ruby and Rails are really fun to learn especially if you start with a toy application. But I found Rails deployment to be a bit more involved than Java deployment. I don't mean using a platform such as Heroku - this really removes all the grunt out of it. I mean deploying Rails while keeping control over the entire stack - i.e. starting from bare metal.
There are tons of tutorials on this subject but the clearest I could find is the one written by Chris Oliver. I followed it quite literally. I chose the Ubuntu 12.04 and rvm and I've been using the most recent versions of the other packages as available from the Ubuntu 12.04 repositories:
Phusion Passenger version 4.0.48
*** LOCAL GEMS ***
On the dev machine I installed, among others,
Despite following the tutorial to the letter I was getting HTTP 500 after deployment.
Setting the correct path for passenger_ruby
I posted a question on Chris's blog and he kindly suggested that Nginx is the likely culprit. After inspecting
I found the following error message
The error message is handily descriptive and checking the above links makes it clear that I had to execute
to find the path to the passenger-config executable. Running it produced:
Relaxing the privileges for the parent directories of the appFixing the ruby path did a change - I started getting HTTP404 instead of HTTP500. Checking the log again I foundAfter a bit of googling it turned out that relaxing the privileges to ALL parent directories is what is needed. I executedfor each of the parent directories.Than re-starting nginx eliminated the problem. Voila!