Does using Passenger Standalone (powered by Nginx core) imply that we do not need the web facing HTTP servers like Apache or Nginx at all?
What is Passenger®? Phusion Passenger® is an open source web application server. It handles HTTP requests, manages processes and resources, and enables administration, monitoring and problem diagnosis.
Passenger® is an app server that runs and automanages your web apps with ease. Also improves security, reliability and scalability.
The Passenger Apache module registers Passenger-specific configuration options inside Apache. You, the administrator, configure Passenger by adding Passenger-specific configuration options to the Apache configuration file. Restart or reload Apache to apply any configuration changes.
The Passenger Nginx module registers Passenger-specific configuration options inside Nginx. You, the administrator, configure Passenger by adding Passenger-specific configuration options to the Nginx configuration file. Restart or reload Nginx to apply any configuration changes.
The short answer is "yes" that is indeed how it works. Basically passenger standalone allows you to run your application via passenger start
, and it uses nginx behind the scenes to actually serve rails requests.
There is one big problem with running passenger standalone as your only webserver, however. If you want to run more than one ruby-based website, you'll have to run them each on separate ports, since there's no way to proxy requests to individual applications with passenger standalone by itself.
In my environment, I needed to run multiple sites using multiple different versions of ruby (not just different versions of rails). For example I have one site running Rails 2.3.x with Ruby Enterprise Edition, and another site running Rails 3.0.x running Ruby 1.9.2. I used passenger standalone with a separate Nginx proxy to solve this problem:
Each website runs passenger standalone, which I have configured to listen on a local UNIX socket. I use RVM to take care of loading my ruby version for me, so my passenger start
command is a bit lengthy, but it looks like this:
cd /path/to/my/app; rvm use ree-1.8.7-2011.03@gemset; export GEM_HOME=/usr/local/rvm/gems/ree-1.8.7-2011.03@gemset; /usr/local/rvm/gems/ree-1.8.7-2011.03@gemset/bin/passenger start -d -S /tmp/mysite.com.sock -e production --pid-file /path/to/my/app/shared/pids/passenger.pid
Now that my app is running and listening at /tmp/mysite.com.sock
, I have another Nginx instance that runs on port 80 that just uses simple proxy_pass rules to send requests to each site individually.
Sorry for the long post, and maybe it's a bit too much information... but I've found that this combo works really well, and I've written some nice init.d
style scripts to launch my individual passenger standalone apps. Nginx memory usage is so amazingly low that it doesn't really cost anything to run 3 instances of it (1 for each site, and 1 on port 80).
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With