Recommendations (and Differences) between different Ruby on Rails Production Web Servers

后端 未结 4 672
情深已故
情深已故 2021-01-31 05:44

Very soon I plan on deploying my first Ruby on Rails application to a production environment and I\'ve even picked a webhost with all the managed server and Capistrano goodness

4条回答
  •  礼貌的吻别
    2021-01-31 06:22

    Short answer

    Go with Apache/Nginx + Passenger. Passenger is fast, reliable, easy to configure and deploy. Passenger has been adopted by a large number of big Rails applications, including Shopify.


    (source: modrails.com)

    The long answer

    Forget about CGI and FastCGI. In the beginning there were no other alternatives so the only way to run Rails was using CGI or the faster browser FastCGI. Nowadays almost nobody runs Rails under CGI. The latest Rails versions no longer provides .cgi and .fcgi runners.

    Mongrel has been a largely adopted solution, the best replacement for CGI and FCGI. Many sites still use Mongrel and Mongrel cluster, however Mongrel project is almost dead and many projects already moved to other solutions (mostly Passenger). Also, a Mongrel based architecture is quite hard to configure because it needs a frontend proxy (thin, ngnix) and a backend architecture composed of multiple Mongrel instances.

    Passenger has been gaining widespread attention since it was released. Many projects switched from Mongrel to Passenger for many reasons, including (but not limited to) easy deployment, maintainability and performance. Additionally, Passenger is now available for both Apache and Ngnix.

    The simplest way to use Passenger is the Apache + Passenger configuration. One Apache installation and multiple Passenger processes.

    If you need better performance and scalability, you can use Ngnix as a frontend proxy and forward all Rails requests to multiple backend servers, each one composed of Apache + Passenger. I'm not going into the technical details here, this solution is intended to be used by Rails projects with an high level of traffic.

    Even more complex solutions include a combination of different levels including http proxies and servers. You can have an idea of what I'm talking about reading some internal details from GitHub and Heroku.

    Right now, Passenger is the best answer for most Rails projects.

提交回复
热议问题