In php, you only need apache or nginx. Why does ruby rails also need something like puma or unicorn when nginx is already installed?
Puma is a small library that provides a very fast and concurrent HTTP 1.1 server for Ruby web applications. It is designed for running Rack apps only.
Both Unicorn and Puma are web servers for Ruby on Rails. The big difference is that Unicorn is a single-threaded process model and Puma uses a multithreaded model.
Unicorn is an HTTP server for Ruby, similar to Mongrel or Thin. It uses Mongrel's Ragel HTTP parser but has a dramatically different architecture and philosophy. In the classic setup you have nginx sending requests to a pool of mongrels using a smart balancer or a simple round robin.
Puma is an HTTP web server derived from Mongrel and written by Evan Phoenix. It stresses speed and efficient use of memory.
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.
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