ruby-on-railsrubynginxunicornpuma

Why does ruby rails need puma or unicorn?


In php, you only need apache or nginx. Why does ruby rails also need something like puma or unicorn when nginx is already installed?


Solution

  • This is not entirely correct, to run PHP with apache you will need either the apache mod_php or run it as a FastCGI module. For Nginx the latter seems to be the norm.

    For Ruby there's Phusion Passenger that fills this role, and supports both apache and nginx. On apache it runs as a plugin module just the way mod_php does. For Nginx I'm not sure.

    You may want to run your ruby applications using a dedicated application server, however. This is where Unicorn, Puma etc comes in. There's nothing preventing you from doing a similar setup for php, but it's less common.

    Another thing which makes php easier to deploy in many cases is that most distros and server installs come with apache and nginx already set up to handle php, while you need to set this up on your own for ruby.

    Once set up Passenger makes deploying ruby apps almost (but not quite) as simple as deploying php apps.