Interfacing with the Web Server with Rack

Rails runs your application in the context of a web server. So far, we have used two separate web servers: Puma, which run standalone, and Phusion Passenger, which integrates with the Apache HTTP web server.

A number of other choices are available, including Mongrel, Lighttpd, Unicorn, and Thin.

Based on this, you might come to the conclusion that Rails has code that allows it to plug into each of these web servers. In earlier releases of Rails, this was true; as of Rails 2.3, this integration was delegated to a gem named Rack.

So, Rails integrates with Rack, Rack integrates with (for example) Passenger, and Passenger integrates with Apache httpd.

Although generally this integration is invisible ...

Get Agile Web Development with Rails 5, 1st Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.