即使应用程序服务器 puma 关闭,rails 服务器如何提供页面?

how does rails server serve pages even when app server puma is down?

我注意到当 puma 服务器关闭和访问站点时显示以下 rails 错误页面。

我认为需要启动 Puma 应用程序服务器才能查看此页面。当应用程序服务器关闭时,如何提供此页面? nginx 是否为该页面提供服务?

I thought puma app server needed to be up in order to view this page. When the app server is down how is this page being served? Is nginx serving this page?

默认情况下 Rails 不提供来自 public 文件夹的静态文件,您看到的页面是由 nginx 提供的静态文件。

Rails中有一个选项:

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?