Phusion white papers Phusion overview

Phusion’s One Year Anniversary Gift: Phusion Passenger 2.2.0

By Ninh Bui on April 16th, 2009

This month is a very special month for Phusion. Not only was it one year ago that we posted our ideas on getting Ruby to work on all PHP platforms (RAHP) as an April fools joke, but it was also the month that Hongli and I officially founded Phusion, the Computer Science company at the Dutch chamber of commerce. Needless to say, seeing as this is Phusion’s first year anniversary as a company, we felt strongly inclined to go the extra mile and make this one count. Instead of making yet another April fools joke, we wanted to take the opportunity to announce a long-awaited addition to our Phusion Passenger line-up. In a way, I guess the joke would be that this really isn’t a joke. :-D

We are glad to announce…

Phusion Passenger for Nginx

Ever since the first release of Phusion Passenger for Apache, some people have been asking us to create a Phusion Passenger for platform XYZ. Well, it may come to you as no surprise but we’ve been playing with similar ideas for quite some time. In fact, we’ve architected Phusion Passenger to be as independent from any specific web server as possible to make something like this an option to consider to begin with.

For us however, maintaining a product to live up to the high quality standards that you’ve come to expect of our products requires a lot of time and effort. Maintaining multiple versions of a project won’t exactly lower this amount of required effort and with limited resources in mind, this made us a bit reluctant on doing something like this from the start. Instead, we chose to focus our efforts on polishing up one version before ever deciding to make the jump to another server platform, a choice from which we’d be able to reap the fruits from in tenfold. Not only in terms of experience, but also in terms of having a more robust and solid code base to work from.

Even though we would be able to share a lot of code between different server versions from an architectural point of view, this would only be a small benefit compared to the work that would still be required. Not only would a fair deal of specific code need to be written but also maintained and documented. This process in particular is painful if the server software you’re writing it for doesn’t have any documentation itself, which became all too apparent for us in some particular cases.

Despite being able to successfully create several versions, we weren’t able to infer significant benefits over the Apache version, both from a technical point of view as well as from an ease of use point of view. In fact, in past articles we’ve elaborated on both points quite a deal and had decided not to pursue its release in favor of polishing the core foundations of Phusion Passenger first and foremost. However, reasons like these usually only play a small part in the choice of technology. Company policies and dependencies of other software usually play a bigger part in deciding this, and with this in mind, Apache might not always be an option. In this regard, we’ve always wanted to accommodate the largest denominator and it is for this reason that the initial version of Phusion Passenger and the ones that followed were exclusively for Apache. Until today that is.

A few weeks ago, as you may still remember from the comments in this article, Ezra of Engine Yard contacted us on the possibility of financially sponsoring a first release of Phusion Passenger for Nginx. Even though we had already written the majority of the code for Nginx Passenger quite a few months ago, we didn’t feel it was the right time to release it back then.

By the time of this writing however, Phusion Passenger is almost one year old and as mature as it has ever been thanks to all the contributions people have made during this time. With this in mind, we decided to accept Ezra’s offer.

After spending weeks on further development and intensive testing, we’ve now come to the point wherein we have the distinct honor to announce Phusion Passenger for Nginx as an addition to the Phusion Passenger server line-up.. Our thanks goes out to Engine Yard for financially sponsoring this first release of Phusion Passenger for Nginx, as well as all the people who have in some way donated in the past for making this release possible in the first place.

Great, how do I get started?

Geoffrey Grosenbach of Peepcode fame has kindly created a screencast for us. This screencast covers everything you need to get started with deploying a Rails/Ruby web application on Nginx using Phusion Passenger.

Nginx screencast by Geoffrey Grosenbach

In a nutshell, you first need to install the Phusion Passenger gem:

sudo gem install passenger

(Note: Rubyforge might still be updating their mirrors. If the above command didn’t install 2.2.0 for you and you can’t wait, then download the 2.2.0 gem from Google Code)

Both the Apache and the Nginx version are contained in the same gem, which keeps things nice and simple!

Next, you need to run the passenger-install-nginx-module command, similar to what you’re used to when installing the Apache version:

sudo passenger-install-nginx-module

Nginx doesn’t support loadable modules like Apache does, so it needs to be compiled from scratch. But the installer can do this for you as well! You can of course also choose to compile Nginx manually. Once Nginx has been compiled and installed, the installer will tell you how to configure Nginx and how to deploy a Rails application on Nginx. A typical deploy server bock looks like this:

server {
    listen 80;
    server_name www.foo.com;
    root /webapps/foo/public;   # <--- notice the 'public' part
    passenger_enabled on;       # <--- don't forget this!
}

We've also spent a lot of effort on documenting Phusion Passenger for Nginx. For detailed installation instructions and usage instructions, please refer to the users guide for Nginx.

If you prefer to install Phusion Passenger via the source tarball instead, then that's also possible. Please read the included README for installation instructions.

Where to report bugs

If you've found a bug, please do not post it in a comment, but file an issue on our issue tracker instead.

Other changes

In addition to bringing you an Nginx version of Phusion Passenger, we've also made improvements in the Apache version. The most important changes are:

Support for chunked file uploads
Resource-limited HTTP clients, such as mobile devices, often send HTTP file uploads using the "chunked" transfer encoding in order to save resources. Previous versions of Phusion Passenger didn't support this, but now it does! Please note that chunked file uploads is only supported in the Apache version; the Nginx version doesn't because doesn't support chunked file uploads.
Support for Capistrano-style deployments
Whenever you deploy a new release with Capistrano, previous versions of Phusion Passenger will leave the application processes of the last release running until they idle timeout. This includes the old release's ApplicationSpawner server process. This is caused by the fact that Phusion Passenger uniquely identifies an application based on its canonical path, meaning that any symlinks in the paths are fully resolved. In Capistrano-style deployments, the 'current' directory is actually a symlink to a release directory, so every time you deploy a new release, Phusion Passenger thinks that it's a totally different application.

This issue has now been fixed, and Phusion Passenger no longer resolves symlinks anymore. So whenever you deploy a new release with Capistrano, Phusion Passenger will properly detect it as being the same application. If you had any hacks in your deploy.rb for killing off old processes, then you can remove them now!

Ability to load application_controller.rb from non-standard directory
In some applications, application_controller.rb is located in the search path, though not in app/controllers. Support for this kind of setup has been fixed.
Worker process event hooks for Rack
The :starting_worker_process and :stopping_worker_process event hooks have been implemented for Rack as well. Thanks to Saimon Moore.

Some final words

We initially planned to announce this release at the coming Railsconf, but the temptation was just too big to announce this on our very first anniversary. Also, if all goes as scheduled, we may have an even bigger announcement at Railsconf, so stay tuned! ;) Follow us on Twitter too to stay in the loop ( @phusion_nl )

  • Morten

    Whoa, way cool! WTG EY and Phusion team :-) “An even bigger announcement”… IIS? *smirk*

  • http://ninh.nl Ninh Bui

    @Morten : errr… computer says no ;-)

  • Fares

    Way to go guys, seriously cool stuff!

  • http://engineyard.com Ezra

    I’ve been working with Hongli to get passenger for nginx tuned and tested in production and I must say I am very impressed. This release melts away any concerns I had and makes passenger pretty much the best way to run your ruby apps. There are still a few things that mongrel or thin are better for(amqp ahem) but if your app works on nginx+passenger then it is what you shoudl use. Performance is great, management is *way* easier then mongrel + monit.

    Nice work guys.

  • Mick Staugaard

    You guys rule! Thank you so much for the incredible work.

  • http://www.blueboxgrp.com Jesse Proudman

    Great work guys! This is fantastic news. Your team has done amazing things for the Rails community over the last year.

  • http://engineyard.com Ezra

    Also a small plug ;) Nginx+Passenger is now available as a tuned stack on http://engineyard.com/solo

    http://www.grabup.com/uploads/38b5d7dbef1de2013d8545d2da79fe6f.png?direct

  • http://www.akitaonrails.com AkitaOnRails

    Again, making life easier for Railers, Congrats!!

  • http://www.twitter.com/withanx Xac Stegner

    This opens up a lot of awesome possibilities. Thanks Engine Yard guys for sponsoring this.

  • Pingback: Passenger Gets Nginx Support: 2.2.0 Released()

  • http://notifixio.us Julien

    I have never been able to run EventMachine correctly inside Passenger for Apache… Maybe this will work for Nginx?

  • http://jerodsanto.net Jerod Santo

    This is HUGE! Very cool, guys. Thanks to Engine Yard for sponsoring this project. I’m excited to see some benchmarks.

  • http://andrewloe.com/ W. Andrew Loe III

    So. Excited.

  • Ivor

    Great stuff! Rails deployment is becoming easier and easier! thanks a million!

  • http://RailsMagazin.de Roland

    awesome! great job!

  • http://www.soocial.com Stefan Fountain

    Great guys! Awesome to see you kicking so much ass! Can’t wait for your announcement at RailsConf.

  • http://idle-hacking.com/ Todd A. Fisher

    How does this performance/scale compared to the apache version? If I have a long running rails request for example, does it block (consume) a whole nginx worker process?

  • http://paperplanes.de Mathias

    That’s awesome, and something I’ve wished for over the last view months. Thanks, guys!

  • http://mdeering.com Michael Deering

    This is outstanding! * goes off to donate $ to this project *

  • Jack Chu

    Great job guys, I’ve been hoping for passenger support in nginx. I can finally ditch my apache installation.

    One question though, while I was going through the advance installation to add some extra compile arguments I noticed that by default the install will add the –without-http_rewrite_module argument to the configuration command. Is there a reason it disables this module? I haven’t seen any mention of this in the user guide. I use the rewrite on some php apps I’m serving from nginx so I kind of need this module. Thanks.

  • http://davidwparker.com David Parker

    This is most excellent! Way to go Phusion! Thanks to Engine Yard for the sponsorship!

  • http://bobnation.org Bob

    Wow, fantastic, and thank you! Now I get to have more fun!

  • http://scottmotte.com Scott Motte

    This is so cool. Thank you!

  • http://andy.delcambre.com Andy Delcambre

    This is AWESOME guys. Just one quick request, can there be an “Option 3″ in the install to only give me the correct ./configure option for me to use myself? I am using it with MacPorts nginx (requires a small change to the portfile) but, there is no checkout of nginx to point the installer at, I had to get a tarball just to make the installer continue.

    Thanks again for the awesome work!

  • http://saimonmoore.net Saimon Moore

    This news just made my day.

    Many thanks.

  • http://plopcentral.com pauliephonic

    Rock, and as they say, Roll!

  • http://evilhackerdu.de/ evilhackerdude

    That’s epic news. When I got time I’ll modify my local development setup.

  • http://cafelinux.nl Thijs Burema

    Yeaah! nginx+modrails it rock!

  • http://cafelinux.nl Thijs Burema

    also easy to install again!

  • http://cafelinux.nl Thijs Burema

    it rocks!

  • Jochen

    Thanks guys!

    By the way, if anyone has an error ‘/bin/sh: bad interpreter: Permission denied’, just do mount -o remount,exec /tmp to make sure files in your /tmp (which is where the files are installed) are executable.

  • http://emptydot.com/vidmantas Vidmantas

    Totally rocks! Waiting for first impressions in production use

  • http://c7.se Peter Hellberg

    Good work guys!

    This will be great for deployments where a full Apache installation would be overkill.

  • http://railslove.com Bumi

    Oh, this is so cool!
    Thanks for giving me nginx back! :D

  • equalizr

    zed is dead baby zed is dead!!!

  • http://chopine.be/lrz Laurent Sansonetti

    Kudos guys!

  • Pingback: C4 » Blog Archive » Passenger on NGINX()

  • http://twitter.com/boosty Sebastian Röbke

    Wow, this is big news! Thanks a lot for the hard work.

  • Pingback: linkfeedr » Blog Archive » Passenger Gets Nginx Support With New Version 2.2.0 - RSS Indexer (beta)()

  • http://www.railscluster.nl Roderick van Domburg

    Choice is good! At RailsCluster, we’ll continue to use Phusion Passenger for Apache because it allows user rewriting and other good things using .htaccess files.

  • Joshua Borton

    Thank you to everyone involved.

  • Emin

    Great news, great job!

    Documentation bug report – content for 5.8.2 is wrong (identical to 5.8.3)

  • http://twittermass.com Jonathan Nelson

    Leave it to you guys and what do you get??? SERIOUS AWESOMENESS

    Thank you for this great addition to Passenger. You rock.

  • http://blog.zerosum.org nap

    Great stuff guys! Thanks for your efforts. I might have to consider a move back to nginx now ;-).

  • http://andrewloe.com/ W. Andrew Loe III

    I updated the Macports Portfile for nginx to also install passenger.

    http://gist.github.com/96657

  • Brendan Kemp

    For those of you who are new to nginx like me, followed the screencast, and were wondering why you got a ‘Welcome to Nginx!’ page instead of your webapp, remove /opt/nginx/html/index.html (default location).

  • spicyj

    Wait, so if the joke is that this isn’t a joke, than that means that this actually is a joke?

  • gregf

    Wow, totally unexpected. Great work guys.

  • http://marklunds.com Peter Marklund

    My app is currently on an Nginx+Monit+Mongrel stack and I have been pushing off moving to mod rails because I wanted to stay with nginx. Sometimes pushing things off is a good thing it seems :-) Now I won’t have to make the switch. Fantastic work! Thanks!

  • Steve Smith

    Amazing!

  • James

    Any word on a lighttpd release ?

  • http://brontesaurus.com/blog Adam

    Very nice! Cant wait to try this out.

  • http://workisfun.ru Mikhail

    Works great!

  • Rahsun McAfee

    Nice work guys! Big win for Passenger! Hip Hip Hooray!

  • http://actsasflinn.com ActsAsFlinn

    Wow, installation was like hitting the easy button. Even better than apache.

  • http://blog.ashchan.com ashchan

    Greatest news of April. Awesome job, guys!

  • Pingback: labria’s ruby blog » Blog Archive » At last!()

  • Pingback: Install Passenger for Nginx on OS X @ 知易行难()

  • http://53cr.com Burke Libbey

    Awesome work. I made a little script to generate apache and nginx/passenger vhosts from a yaml file. Somebody might find it useful: http://github.com/burke/webconfig/tree/master

  • Pingback: kangjin's me2DAY()

  • Pingback: Phusion’s One Year Anniversary Gift: Phusion Passenger 2.2.0 « A little story()

  • Pingback: Passenger есть теперь и для nginx | 0utPunk's Blog()

  • http://www.biorelated.wordpress.com George

    You guys Rock!!! Thank you!!

  • Pingback: Phusion’s One Year Anniversary Gift: Phusion Passenger 2.2.0 … « My New Blog()

  • Sergey A. Osokin

    Can’t build with nginx-0.7.51:

    cc -c -pipe -g -DNGX_DEBUG_MALLOC -g -I /usr/local/include -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/local/include/libxml2 -I /usr/local/include -I objs -I src/http -I src/http/modules -I src/http/modules/perl -I src/mail -o objs/addon/nginx/Configuration.o /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c: In function `passenger_merge_loc_conf':
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: error: `ngx_garbage_collector_temp_handler’ undeclared (first use in this function)
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: error: (Each undeclared identifier is reported only once
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: error: for each function it appears in.)
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: warning: passing arg 1 of `ngx_conf_merge_path_value’ from incompatible pointer type
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: warning: passing arg 2 of `ngx_conf_merge_path_value’ from incompatible pointer type
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: warning: passing arg 3 of `ngx_conf_merge_path_value’ from incompatible pointer type
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: warning: passing arg 4 of `ngx_conf_merge_path_value’ makes pointer from integer without a cast
    /usr/home/osa/ports/www/nginx-devel/work/passenger-2.2.0/ext/nginx/Configuration.c:402: error: too many arguments to function `ngx_conf_merge_path_value’
    *** Error code 1

  • http://rwsleep.blogspot.com Jan

    great news. thanks guys!

  • http://blog.zohararad.com Zohar

    This is great news! Thanks a lot for your efforts guys. Just installed Passenger for Apache last week and am loving it. I’ll be sure to check the Nginx version as well :)

  • Pingback: Passenger For Nginx @ IverCore()

  • Pingback: Overwhelming Software World « matt greer’s blog()

  • http://frank.be/ Frank

    You guys are my gods! Even the user-switching works. Love it!

  • http://jaigouk.blogspot.com Jaigouk

    wow!!
    Am I dreaming?

  • http://wwww.railsgeek.com/2009/3/2/internet-explorer-free-ubuntu-linux-virtualbox mikhailov

    It’s wonderful!
    I’m going to moving to passenger with my nginx!

  • Pingback: iWeb Blog » Nouvelles Techno iWeb: gzip, github, passenger avec nginx()

  • Pingback: iWeb Blog » iWeb Tech News Highlights: Gzip, Github issue tracker, Passenger for Nginx()

  • Pingback: Passenger suporta Nginx com a nova versão 2.2.0()

  • Richy

    Great work! It’s a real surprise.

  • http://53cr.com Burke Libbey

    @sergey The newest nginx it will compile with is 0.7.43. This change broke it: http://gist.github.com/96873

  • http://terra-firma-design.com Brian Getting

    This is great news. However, am I the only one that this isn’t working for? I get it installed alright, set my /etc/hosts, flush DNS, then go to the local address, and I get “Welcome to nginx!”. When I delete the index.html file in /opt/nginx/html I get “Permission Denied”. Seems like for some reason it is not picking up the server block in the config file. Anyone else having problems.

    This is going to be great. Thanks for the hard work!

  • Pingback: links for 2009-04-17 « Mike Does Tech()

  • Pingback: links for 2009-04-17 « Bloggitation()

  • Pingback: Technology Info » Links for 2009-04-17 [del.icio.us]()

  • Pingback: Cairo'sBlog()

  • Pingback: Run Rails Apps on Nginx In Minutes with Passenger 2.2.1()

  • http://www.linux4rails.com Linux for Rails

    This is Phusion ’s first year anniversary as a company.

    Linux for Rails and its staff wish you an Happy Birtday.

    Thank you Phusion for your job done.

  • Pingback: Blog Esse » Blog Archive » Mod_rails (Phusion Passenger) dla Nginxa!()

  • Pingback: Phusion Passenger 2.2.0 | E.V.Schoemaker()

  • Pingback: Bastl.org » Phusion Passenger 2.2.1 released()

  • Pingback: Brightbox Blog - Ruby on Rails Hosting - Passenger 2.2.1 Ubuntu beta packages with NGINX support()

  • http://www.railsgeek.com mikhailov

    I’m already on mod_rails, feeling myself like get in the new car :)

  • Pingback: Success Story: Globago.com | RailsMagazin - Alles rund um Ruby on Rails()

  • Pingback: almost effortless » Weekly Digest, 5-3-09()

  • Pingback: Dev Blog AF83 » Blog Archive » Veille technologique : Langages, Google App Engine, Javascript, Ruby, Rails, Profiling, PDF, Infrastruture, Performances web()

  • http://www.siliconsalad.com Olivier Ferlin

    Good Job !
    Is there any benchmarks Apache vs. Nginx ?
    Thanks
    Olivier

  • Pingback: Ruby-Enterprise Edition, Fusion Passenger, and Nginx on Ubuntu Jaunty « Tejus’s Blog()

  • Pingback: Getting Phusion Passenger to install nginx with SSL support « Ruby on Rails()

  • Pingback: In praise of Slicehost « Code & Complaints()

  • Pingback: Passenger + Capistrano + Nginx + Rails 2.3.4 + Ubuntu 9.04 (10 steps) « Technical notes()

  • Pingback: Nginx en reverse proxy pour plusieurs blogs Wordpress | AbriCoCotier.fr()

  • Pingback: Study Notes: Passenger + Capistrano + Nginx + Rails 2.3.4 + Ubuntu 9.04 (10 steps) | Refactoring Thoughts()

  • Pingback: How to scale down for low memory server? Drija()