devroom.io/drafts/2012-05-11-running-a-different-ruby-with-passenger-3-2-and-rvm.md
Ariejan de Vroom dbae98c4c0 Moar updates
2013-03-24 14:27:51 +01:00

57 lines
2.3 KiB
Markdown

---
title: "Running a different ruby with Passenger 3.2 and RVM"
kind: article
slug: running-a-different-ruby-with-passenger-3-2-and-rvm
created_at: 2012-05-11
tags:
- Ruby
- rvm
- passenger
- nginx
---
Passenger 3.2 will have quite some nice new features. [1](http://blog.phusion.nl/2012/04/13/a-sneak-preview-of-phusion-passenger-3-2/) [2](http://blog.phusion.nl/2012/04/25/a-sneak-preview-of-phusion-passenger-3-2-part-2/)
The features I'm looking forward to most is the ability to specify - per virtual server - which ruby to use.
Before, you installed passenger and specified the required ruby version using `passenger_ruby`, like this in your `nginx.conf`:
http {
passenger_root /opt/passenger;
passenger_ruby /usr/local/bin/ruby;
server {
server_name ariejan.net;
passenger_enabled on;
}
}
Now, if you added another server it would be forced to use the same ruby version. This might be okay for most servers, but for me not so much. I have several side-projects running on a single machine, and using only one ruby version is not optimal or even impossible.
Now, with the upcoming Passenger 3.2 you can select a ruby version *per server*. This is awesome. All you have to do is move the `passenger_ruby`directive into the `server` block and all is set. Of course, you can leave the globally set ruby just as is.
http {
passenger_root /opt/passenger;
passenger_ruby /usr/local/bin/ruby;
server {
server_name ariejan.net;
passenger_enabled on;
passenger_ruby /home/deployer/.rvm/rubies/ruby-1.9.3-p194/bin/ruby;
}
}
As you can see in the example above, I'm referencing ruby-1.9.3-p194, installed with RVM.
### Installing "experimental" Passenger
The installation is easy, as usual, but you must checkout the passenger source from Github and use the `experimental` branch.
**Warning: do not install the `experimental` branch of Passenger on your production server unless you are absolutely sure what you're doing and you know how to rollback quickly and easily to a stable version of passenger.**
cd /opt
git clone https://github.com/FooBarWidget/passenger.git
cd /opt/passenger
git checkout -b experimental origin/experimental
./bin/passenger-install-nginx-module