Phusion Passenger & running multiple Ruby versions
One of the questions we’ve been getting a lot lately is whether it’s possible to run multiple Ruby versions with Phusion Passenger, e.g. have app A and B run on Ruby 1.8.7 while having app C run on Ruby 1.9.2. In previous versions of Phusion Passenger there were ways to get around that, e.g. by mixing in Mongrels. As of Phusion Passenger 3 you can run all components as Phusion Passenger.
The setup that we currently recommend is to combine Phusion Passenger for Apache or Phusion Passenger for Nginx, with Phusion Passenger Standalone. One must first identify the Ruby version that you use most. One then proceeds with setting up Phusion Passenger for Apache or Phusion Passenger for Nginx to use that Ruby version. All applications that are to use a different Ruby version can be served separately through Phusion Passenger Standalone and hook into the main web server via a reverse proxy configuration.
Example

Suppose that you have four websites:
- foo.com, to run on Ruby 1.8.7.
- bar.com, to run on Ruby 1.8.7.
- fries.com, to run on Ruby 1.9.1.
- hamburgers.com, to run on Ruby 1.9.2.
And suppose that you’re using RVM to manage these Rubies.
Setting up foo.com and bar.com (Ruby 1.8.7)
The Ruby version that you use most is Ruby 1.8.7, so you setup Apache or Nginx to use Ruby 1.8.7 and to serve foo.com and bar.com.
rvm use 1.8.7 gem install passenger --pre # Then one of: passenger-install-apache2-module passenger-install-nginx-module
# Partial Apache configuration
PassengerRuby /home/someuser/.rvm/wrappers/ruby-1.8.7/ruby
<VirtualHost *:80>
ServerName www.foo.com
DocumentRoot /webapps/foo.com/public
</VirtualHost>
<VirtualHost *:80>
ServerName www.bar.com
DocumentRoot /webapps/bar.com/public
</VirtualHost>
# Partial Nginx configuration
passenger_ruby /home/someuser/.rvm/wrappers/ruby-1.8.7/ruby
server {
listen 80;
server_name www.foo.com;
root /webapps/foo.com/public;
passenger_enabled on;
}
server {
listen 80;
server_name www.bar.com;
root /webapps/bar.com/public;
passenger_enabled on;
}
foo.com and bar.com have now been deployed on Phusion Passenger for Apache or Phusion Passenger for Nginx, and running on Ruby 1.8.7.
Setting up fries.com (Ruby 1.9.1)
The next step is to start fries.com in Phusion Passenger Standalone using Ruby 1.9.1. Since port 80 is already used by Apache or Nginx, we use start Phusion Passenger Standalone on a different port.
rvm use 1.9.1 gem install passenger --pre cd /webapps/fries.com passenger start -a 127.0.0.1 -p 3000 -d
Fries.com is now running on localhost port 3000 as a background daemon. Next, connect it to Apache or Nginx via a reverse proxy.
# Partial Apache configuration
<VirtualHost *:80>
ServerName www.fries.com
DocumentRoot /webapps/fries.com/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:3000
ProxyPassReverse / http://127.0.0.1:3000
</VirtualHost>
# Partial Nginx configuration
server {
listen 80;
server_name www.fries.com;
root /webapps/fries.com/public;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
}
}
Setting up hamburgers.com (Ruby 1.9.2)
We do the same thing for hamburgers.com. Port 3000 is already in use, so we assign it to port 3001.
rvm use 1.9.2 gem install passenger --pre cd /webapps/hamburgers.com passenger start -a 127.0.0.1 -p 3001 -d
Then we hook it up to the web server via reverse proxying.
# Partial Apache configuration
<VirtualHost *:80>
ServerName www.hamburgers.com
DocumentRoot /webapps/hamburgers.com/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:3001
ProxyPassReverse / http://127.0.0.1:3001
</VirtualHost>
# Partial Nginx configuration
server {
listen 80;
server_name www.hamburgers.com;
root /webapps/hamburgers.com/public;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
}
}
Performance tip
Phusion Passenger Standalone also supports listening on a Unix domain socket instead of a TCP socket. Unix domain sockets are significantly faster than TCP sockets.

Only Nginx supports reverse proxying to Unix domain sockets; Apache does not support this.
In order to make Phusion Passenger Standalone listen on a Unix domain socket, you need to run it with Nginx 0.8.21 or higher. In fact we contributed support for Unix domain sockets to Nginx specifically for this feature!
Start Phusion Passenger Standalone like this:
passenger start --socket /tmp/fries.com.socket -d --nginx-version 0.8.50
The --socket option tells Phusion Passenger to bind to the given Unix domain socket. The --nginx-version option tells Phusion Passenger Standalone to use Nginx 0.8; 0.7 is the default.
Next you must setup an Nginx upstream block with the Unix domain socket as the only entry. Then setup Nginx to reverse proxy to the created upstream block.
upstream fries_upstream {
server unix:/tmp/fries.com.socket;
}
server {
listen 80;
server_name www.fries.com;
root /webapps/fries.com/public;
location / {
proxy_pass http://fries_upstream;
proxy_set_header Host $host;
}
}
It should be noted that Phusion Passenger for Apache and Phusion Passenger for Nginx already use Unix domain sockets internally for optimal performance. In fact we’ve done this since version 1.0. We plan on elaborating more about our internal technologies in a future blog post.
Conclusion
Those of you who are familiar with Mongrel and Thin will see the similarity. Indeed, Phusion Passenger Standalone was designed to be able to used in a reverse proxy environment such as the one demonstrated in this article. Unlike Mongrel and Thin clusters however you only need a single Phusion Passenger Standalone instance per web application and thus only a single address to proxy to. Phusion Passenger Standalone will take care of starting and stopping application processes for you and will make sure processes are restarted when they crash.
Phusion. All rights reserved.
Great writeup! Can’t wait for the final release.
Good blog post, but still not a great solution. I use Passenger largely so I don’t have to mess around with things like reverse proxy configuration; this essentially nullifies Passenger’s big advantage. Out of curiosity, what’s the technical obstacle to giving each Passenger application its own Ruby interpreter?
I wouldn’t say it nullifies Passenger’s big advantage; you still don’t have to manage a whole cluster for each application but just a single standalone instance for starters. In addition, crashing apps are being restarted automatically for you as well etc..
As for your other question, from a technical point of view there shouldn’t be an obstacle I think, so start coding and I’ll gladly take a look at your patch
[...] Phusion Passenger & running multiple Ruby versions – Phusion Corporate Blog – Getting closer to all your rubies on the web with a single browser front end, proxied with passenger standalone [...]
A little bit sad that for this case it will be needed to mess with running standalones in system startup. But otherwise perfect that’s already possible, was been missing this feature very much!
I think the one of advantages of Passenger is ease of starting processes, writing vhost settings, reload apache or nginx and done. Passenger Standalone seems to need to start by hand or writing custom init scripts. Is it possible in the near future to start Passenger Standalone processes like embedded ones?
One of the problems I see here is I need to manage many standalone Passengers (one per application). And Apache/Nginx with built in Passenger can serve many application. So I still would rather expect for having RubyVersion per vhost, not only once.
Thin and Mongrel are old solutions. There are better solutions like Rainbows! (http://rainbows.rubyforge.org/) or multithreaded Zbattery (http://zbatery.bogomip.org/), they both are based on Unicorn (http://unicorn.bogomips.org/) but add more features.
The benefit of Thin/Unicorn/Rainbows/Zbattery is WebSocket support so they can be used for creating real time web applications.
Is Passenger3 standalone supporting web sockets or have it in plans?
First of all, great job!
I’m trying the –socket option, but passenger complains about missing file like this:
/home/wsouto/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.0.pre3/lib/phusion_passenger/standalone/command.rb:213:in `initialize’: No such file or directory – /tmp/testapp1.sock (Errno::ENOENT)
Here is how I’m invoking passenger inside my Rails app (testapp1) directory:
passenger start –socket /tmp/testapp1.sock -d –nginx-version 0.8.50
I’m not sure but, does not passenger meant to open/create the socket file?
@Walter: did you make sure Nginx >= 0.8.21 or higher is used as per the instructions?
[...] Phusion Passenger & running multiple Ruby versions [...]
@Walter: It looks like you missed a ‘-’ character in some of your arguments. The arguments that are spelled out require two dashes. So –socket and –nginx-version.
[...] Artigo traduzido do blog da Phusion: http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/ [...]
Can you please share any examples of init script for standalone passenger applications? I’ve googled but didn’t find anything.
Thanks.
I ran into this problem, when I wanted to update my own app but then found out redmine didn’t run on 1.9.2 yet. I ended up installing nginx with passenger for my 1.8.7 apps, and appache/passenger for my 1.9.2 apps. then I proxypass all apps from apache to nginx that need it.
pls fix s/upsteam/upstream/ in the text.
thank you,
@Alexey Mahotkin:
Fixed, thanks
I couldn’t get the proxy to work on OS X 10.6.4 with the system Apache 2.2.14, until I added a trailing slash on the ProxyPass and ProxyPassReverse in the vhost’s .conf file:
ProxyPass / http://127.0.0.1:4545/
ProxyPassReverse / http://127.0.0.1:4545/
With the trailing slash after the port number, everything seems to work fine.
@Walter – Were you able to fix your socket issue? I’m having the same problem…
Also has anybody got a working init script? Haven’t found one yet and can’t seem to get it working myself.
Thanks,
Ulf
Awesome work! I’m also having the socket issue. Works great with nginx other than that! Anyone else have this problem?
passenger start –socket /tmp/istink.local.socket -d –nginx-version 0.8.52
gives me
/Users/george/.rvm/gems/ree-1.8.7-2010.02@istink/gems/passenger-3.0.0.pre4/lib/phusion_passenger/standalone/command.rb:213:in `initialize’: No such file or directory – /tmp/istink.local.socket (Errno::ENOENT)
from /Users/george/.rvm/gems/ree-1.8.7-2010.02@istink/gems/passenger-3.0.0.pre4/lib/phusion_passenger/standalone/command.rb:213:in `new’
Got me out of a rut, thanks.
For anyone implementing this on Ubuntu and apache, I had to remove the proxy.conf link in mods-enabled. Otherwise I was getting a 403 error when trying to access the site.
Dave, I believe that this will expose you to become a mailing zombie if you bypass any proxy configuration.
I found out that you need to allow 120.0.0.1 in your configuration but that doesn’t seem to be enough.
My configuration is set like this http://pastie.org/1237032
I’ve tried a lot over the last two days but I keep having the same 403 error…
Please help!
[...] 还有一篇介绍比较详细的示例文章:Phusion Passenger & running multiple Ruby versions [...]
Okay, I fixed the 403 issue I was having, if you have the same thing, make sure that in the proxy.conf, you don’t have “Deny from all” after “Order deny, allow”… just do like this:
Order deny,allow
Allow from 127.0.0.1
that’s it… also, you definately have to add the trailing / after http://127.0.0.1:3001 for the ProxyPass and ProxyPassReverse
Hope this helps…
I also got the 403 issue, but changing the proxy.conf doesn’t work for me. Here are the error messages from passenger.3000.log:
[...] open() “/*path_to_my_rails_app*/public/login” failed (13: Permission denied), client: 127.0.0.1, server: _, request: “GET /login HTTP/1.1″, host: “127.0.0.1:3000″
I’m irritaded on the url ending with /public/login. I was wonderring if the rewrite thing doesn’t work fine, but don’t know where to have a look at. My vhost is set up as following:
ServerName my-rails-app
ServerAlias http://www.my-rails-app
PassengerEnabled off
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
And the proxy.conf looks like this:
#ProxyRequests On
Order deny,allow
Allow from 127.0.0.1
ProxyVia On
Playing with Deny and Allow from doesn’t change anything.
I also changed the permission to my rails-app dir to 777. But result is only a warning while starting the passenger standalone server, which points me to some security risks…
What am i missing at all?
By the way: I started the passenger standalone server as root with following:
passenger start -a 127.0.0.1 -p 3000 -d
Nice one, but the main problem with this is that all off the requests to the ‘proxied’ standalone application are coming from 127.0.0.1 and it is impossible to track the IP of the users. Is there a workaround for this?
I ran into problems in my Rails app when using Unix domain sockets.
The Rails 3 redirect(‘…’) in my routes.rb didn’t work (an error saying that my_app_upstream is not a valid URL) and the URL helpers use my_app_upstream as the default host, so that for example root_url resolves to http://my_app_upstream/
Switching back to TCP sockets for now.
Anybody else had those or similar problems?
Manuel has already solved the problem by adding proxy_set_header to the Nginx conf. I’ve updated the blog post.
[...] http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/ [...]
Hi when type
passenger start -a 127.0.0.1 -p 3000 -d
I am getting error like
/usr/local/rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2/lib/phusion_passenger/platform_info/ruby.rb:315: command not found: /usr/local/rvm/wrappers/ruby-1.8.7-p330/rake package:filelist –silent
/usr/local/rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2/lib/phusion_passenger/platform_info/ruby.rb:315: command not found: /usr/local/rvm/wrappers/ruby-1.8.7-p330/rake nginx RELEASE=yes –dry-run
/usr/local/rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2/lib/phusion_passenger/platform_info/ruby.rb:315: command not found: /usr/local/rvm/wrappers/ruby-1.8.7-p330/rake nginx RELEASE=yes –trace STDERR_TO_STDOUT=1
*** ERROR: the following command failed:
What might be the problem?
It means RVM is broken. Reinstall it.
Thanks for your reply.
Before updating rvm I did
rvm –version => rvm 1.0.11 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
Now I did
rvm update
rvm reload
rvm –version => rvm 1.1.13 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
And I I did same step above. But same error comes again. Need I uninstall rvm and reinstall it again? If that happens need I renstall all my installed ruby versions?
It is solved as you suggested. Uninstalled and reinstalled rvm. Thanks
[...] Phusion Passenger & running multiple Ruby versions (tags: ruby rails nginx rvm sysadmin) [...]
If anyone finds they’re having problems with gems not being found when using rvm gemsets under the scenario above, I found this helpful post: http://dalibornasevic.com/posts/21-rvm-and-passenger-setup-for-rails-2-and-rails-3-apps
Hi,
I followed directions, and tried the solutions posted for the 403 errors,
on ubuntu
I am getting a 403 from the proxy,
I did
a2enmod proxy
a2enmod proxy_connect
a2enmod proxy_http
and edited the proxy.conf to allow the localhost,
what else can be wrong?
self correction,
I looked at the apache logs,
it said that by configuration my remote (client) ip wasn’t allowed to pass requests to the proxy,
seems the proxy works in a transparent mode so I had to enable Allow form all in the proxy.conf
form the apache doc,
reverse proxying goes like this
Reverse Proxy
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar
this is to adjust the capistrano deploy if you are using it,
namespace :deploy do
task :restart, :roles => :app, :except => {:no_release => true} do
run “start-stop-daemon –stop –name nginex”
run “cd #{deploy_to}/current && passenger start -a 127.0.0.1 -p 3000 -d -e #{environment}”
end
end
At least on my setup (Ubuntu 10.10, Apache 2.2.16, rvm 1.2.6 with ruby 1.9.2, Passenger 3.0.2), I need a trailing slash on the second argument to the ProxyPass/ProxyPassReverse to make the routing run smoothly.
Otherwise, it would just give me a 502 with an error that resembled the following:
proxy: DNS lookup failure for: 127.0.0.1:3001home returned by /home, referer: http://mydomain.com/
So my apache configuration lines were:
ProxyPass / http://127.0.0.1:3001/
ProxyPassReverse / http://127.0.0.1:3001/
Please disregard previous post. Fixed typo.
Hi – I would like to build this setup on a Mac Box with Snow Leopard Server (10.6.6), being able to run several applications with different ruby Versions. Following the instructions on this site, I am running in some troubles starting passenger-standalone. Using the following setup -
- rvm 1.2.6
- rails 3.0.3
- ruby 1.9.2
- passenger-standalone 3.0.2
Starting passenger, I get the following error:
/var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/platform_info/binary_compatibility.rb:68:in “’: Permission denied – getcwd (Errno::EACCES)
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/platform_info/binary_compatibility.rb:68:in `ruby_extension_binary_compatibility_ids’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/platform_info.rb:92:in `ruby_extension_binary_compatibility_ids’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/native_support.rb:43:in `archdir’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/native_support.rb:72:in `load_from_source_dir’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/native_support.rb:33:in `start’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/native_support.rb:166:in `’
from :29:in `require’
from :29:in `require’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/lib/phusion_passenger/utils.rb:37:in `’
from :29:in `require’
from :29:in `require’
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/helper-scripts/passenger-spawn-server:102:in `rescue in ‘
from /var/lib/passenger-standalone/3.0.2-x86_64-ruby1.9.2-macosx-10.6/support/helper-scripts/passenger-spawn-server:30:in `’
Regards
playing around I found the problem:
starting passenger with “–user root” is working now.
Starting passenger without this option (even I am logged in as root) brings up thee error.
If you are using the bash RVM client to manage your Rubies, as opposed to the RVM gem, is there a good way to specify to Passenger which gemset to use?
I found this blog that shows how you can specify which gemset to use, but it it using the RVM gem and I use the bash client:
http://blog.ninjahideout.com/posts/the-path-to-better-rvm-and-passenger-integration
But it uses the RVM gem and I am currently using the bash script. Is there a way to define the Passenger gemset without the RVM gem? Or are there advantages to using the gem instead of bash script?
@David: I used a bit different approach to select gemset – it is automatically used by wrapper to god and while environment is then inherited to passenger: http://niczsoft.com/2011/03/passenger-standalone-with-god-on-rvm/
@Hongli Lai
I am having the same problem as that of Walter. There is no socket file in /tmp/myapp.socket or anywhere in the system that I could use. Kindly help me out here. This solution is very good and I need this to work. I deployed phusion passenger and nginx and ROR 1.8.7 and 1.9.2 according to the above tutorial/instructions but I am stuck with this only problem that I don’t have any socket file that I could use. I did a system wide search for such file, after starting passenger standalone but no success. Kindly help me out here as soon as possible. Thanks
The example Apache proxy configuration seems to have two problems:
First, the ProxyPass and ProxyPassReverse directives need a trailing slash:
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
Second, there needs to be a section to define access permissions to the proxy:
Order allow,deny
Allow from all
Looks like the forum helpfully stripped out part of the code. Let’s try this instead:
[...] Phusion Passenger & running multiple Ruby versions – Phusion Corporate Blog (tags: passenger multiple rubyonrails) [...]
I am getting this proxy error while
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /login.
Reason: DNS lookup failure for: 127.0.0.1:3001login
My Setup :
Ruby – 1.9.2 –default ruby in RVM
Ruby-1.8.7 — Passenger started with Standalone
I have started passenger standalone with following command
passenger start -a 127.0.0.1 -p 3001 -e production -d
My Virtual host entry
ServerName redmine.xxx.com
DocumentRoot /var/www/redmine/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:3001
ProxyPassReverse / http://127.0.0.1:3001
Please help me..
To anyone having problems with apache proxy-pass, you need to have 3 mod enabled:
a2enmod proxy
a2enmod proxy_balancer
a2enmod proxy_http
[...] As it stands, Passenger does not support running apps under different interpreters using the apache or nginx modules, I came across this article [...]
I’m using Apache, which is running 1.8.7. I’m attempting to put 1.9.2 in the proxy.
I followed the instructions, but I get nginx’s standard 404 error page. In the log I have:
“GET /help.html HTTP/1.1″ 404 131
I’ve double checked everything. Is there a module that I need to include, or perhaps a hole I need to poke in the firewall?
What I find odd is that the passenger standalone is running nginx (in fact, installed it for me.) Is there a way to get it to run Apache? And, I’ve done no configuration of nginx at all. Do I need to, and how would I do that?
On both OS X and Linux, the first time I started Passenger Standalone it failed with (truncated):
** Execute (dry run) nginx
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:224:in `*’: negative argument (ArgumentError)
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:224:in `show_progress’
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:147:in `block in install!’
from /usr/local/rvm/gems/ruby-1.9.2-p180/gems/passenger-3.0.7/lib/phusion_passenger/standalone/runtime_installer.rb:423:in `block (2 levels) in install_passenger_support_files’
…
Starting it again went through the install process again, but with success. Subsequently restarting Passenger Standalone worked with no issues.
[...] Phusion Passenger & running multiple Ruby versions [...]
Really great Article…. work like charm..
Just one query.. How to make standalone passenger daemon start permanently.. I have to start it manually after server startup.
Can I use Cron for that ?.
# passenger start -a 127.0.0.1 -p 3000 -d
[...] specific user and its specific Ruby version. Apache was already running through its system user. This post persuaded me to try [...]
[...] Phusion recommend that to run 1.8 apps alongside 1.9 apps you use the Apache module for one version and multiple instances of the standalone version of Phusion Passenger (which I think is basically just an instance of nginx). Because we want to start using 1.9 as standard I decided to have the Apache module running on 1.9 and use instances of the standalone version for 1.8 apps. [...]
As commented by Jack Morrill the apache config doesn’t work unless you append a trailing / to the proxy addresses. Only the homepage will work, when you try to access e.g. /refinery it will give a proxy dns error. Adding the trailing / fixes it.
Nice writeup, but having to run additional daemons partly defeats the purpose of Passenger to offer ease of use. The feature request hasn’t moved an inch, so if you’d like to see multiple Rubies in Passenger, cosider voting up (aka: starring) the bug:
http://code.google.com/p/phusion-passenger/issues/detail?id=388
Also worth mentioning: your Apache server needs to have the necessary modules enabled. Run:
sudo a2enmod proxy proxy_http
Then restart you Apache. That should do the trick.
[...] Passenger is essentially ‘mod_ruby’ for both Nginx and Apache. You may select *exactly one* Ruby to run all of your Passenger Ruby applications with. If you need to run more than one Ruby interpreter then you should choose the most common one as Passenger Ruby. You then use proxy pass to external application servers such as Passenger Standalone, Unicorn, Thin, Mongrel, Mongrel2, etc… in order to accomplish running different applications under different rubies. For a full explanation of this (with pretty pictures!) see the post on Phusion’s Blog [...]
# Partial Apache configuration
ServerName http://www.hamburgers.com
DocumentRoot /webapps/hamburgers.com/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:3001/ # / at the end of this line is important.
ProxyPassReverse / http://127.0.0.1:3001/ # / at the end of this line is important.
Great tutorial, I wanted to setup mutli-version ruby hosting so that’s exactly what I am looking for!
Works fine for me… RoR 3.1.3, Ruby 1.9.3 and Passenger 3.0.11. Thx!
My Setup:
BalancerMember http://127.0.0.1:3000
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]
ProxyPass / balancer://thinservers/
ProxyPassReverse / balancer://thinservers/
ProxyPreserveHost On
Order deny,allow
Allow from all
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass /javascripts !
Alias /images /xyz/public/images
Alias /stylesheets /xyz/public/stylesheets
Alias /javascripts /xyz/public/javascripts
#deflate
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml.
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
[...] Phusion Passenger & running multiple Ruby versions – Phusion Corporate Blog カテゴリー: Ruby on Rails タグ: Phusion Passenger, Ruby, Ruby on Rails, RVM 作成者: 野口 航 この投稿のパーマリンク [...]
Hi there, i was trying this but got the unix socket error on nginx.
I followed the config with: passenger start –socket /tmp/redmine.socket1 -d –nginx-version 0.8.55 but gives me this error command.rb:213:in `initialize’: No such file or directory – /tmp/redmine.socket2 (Errno::ENOENT)
Anyone got a solution for this?
Tks
Hi all,
I’ve made a script to automatically launch multiple instance of Phusion Passenger called passengers. Don’t take time to read all comments :s but I hope it’s usefull for others.
Explanation here : http://www.harchiblog.com/2011/04/23/centralize-launches-of-passenger/
[...] this setup only one version of ruby can be used. If you want/have to use multiple versions of ruby, check this [...]