Pow/Phusion Passenger/Webrick 如何工作?
我来自 PHP 和 .NET 世界,我对环境非常了解。然而,我找不到关于 Ruby / Ruby on Rails 堆栈如何与这些 Web 服务器实际工作的新手解释。
它们是否更接近 PHP 模型,其中应用程序的所有类都是每个请求的加载程序,并且没有默认的共享内存,或者它就像一个应用程序服务器,其中活动的应用程序位于内存中并处理请求?
文件更改时重新加载如何?应用服务器中的应用需要重启吗?它是怎么知道的?它监控文件系统吗?
我发现 Ruby 版本管理器 (rvm
) 和来自 37signals 的较新的 rbenv
都显示了 OS X / Linux 上的 ruby
命令的随机播放情况。这对我来说简直就是一个魔法。网络服务器是否只运行 ruby 命令而不关心解释器在 $PATH 中的解析位置?
I come from a PHP and .NET world where I understand the environment fairly well. However I can't find a newbie explanation of how the Ruby / Ruby on Rails stack actually work with these web server.
Are they more close to the PHP model, where all classes of an application are loader for each request and there is no default shared memory, or is it like an application server where an active app sits in the memory and handles requests?
How is it with reloading when a file changes? Does the app in an application server has to be restarted? How does it know? Does it monitor file system?
I have seen that both the Ruby Version Manager (rvm
) and the newer rbenv
from 37signals shomewhat shuffles with the ruby
command on OS X / Linux. This seems like a total magic to me. Does a webserver just runs ruby
command and does not care where the interpreter is resolved in the $PATH
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Webrick是Rails的默认服务器,通常用于开发和测试。
Rails 与 PHP 一样是基于会话的。如果你想在生产环境中运行,你通常会在 Apache 或 Nginx 上使用 Phusion Passenger,现在不用担心。
如果您在开发或测试环境中运行,您可以编辑应用程序文件(视图、控制器和模型),并且它们将根据每个请求重新加载(即使它们没有被编辑)。
查看使用 Rails 生成项目和支架来帮助您入门。
http://guides.rubyonrails.org/getting_started.html
Webrick is the default server of Rails and is usually used for developing and testing.
Rails is session based like PHP is. If you want to run in production you will generally use Phusion Passenger on Apache or Nginx, dont worry about that for now.
If you run in Development or Test environment you can edit your application files(views, controllers and models) and they will be reloaded on each request (even if they are not edited).
Have a look at generating a project and scafolds with Rails to get you started.
http://guides.rubyonrails.org/getting_started.html