【问题标题】:Ruby on Rails header for sending files In NGINX用于在 NGINX 中发送文件的 Ruby on Rails 标头
【发布时间】:2016-11-09 12:48:31
【问题描述】:

我的应用程序在 Nginxpassenger 服务器上运行。在production.rb 里面我看到一行写着:

# Specifies the header that your server uses for sending files.
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

它如何指定标头来发送文件? Rails 如何在不开启此功能的情况下发送文件?

打开它是个好习惯吗?它是否使我的应用程序运行得更快?

【问题讨论】:

    标签: ruby-on-rails ruby nginx server


    【解决方案1】:

    send_filedocumentation 中解释了该行为

    您应该使用此选项,它会使您的应用程序更快,这是一个很好的做法。

    如果不使用这个选项,文件会被ruby进程读取,发送到nginx再发送到客户端。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-08
      • 2013-01-21
      • 1970-01-01
      • 2012-07-19
      • 1970-01-01
      • 2015-09-04
      相关资源
      最近更新 更多