Rails 3.1.1 使用 Apache 进行 HTTP 流式传输乘客

发布于 2024-12-11 08:32:35 字数 196 浏览 0 评论 0原文

在关于 HTTP 流的 Railscasts 中,一些评论者已经确认可以使用 Apache + Passenger 进行 http 流,但奇怪的是我无法通过 Google 找到任何说明。

Rails 文档也没有提供任何说明。所有详细说明均参考 Unicorn。我一定不是唯一一个想通过 Apache 和 Passenger 进行 http 流处理的人。请帮忙。

In the Railscasts about HTTP streaming some commenters have confirmed that one can do http streaming with Apache + Passenger but strangely I can't find any instructions via Google.

Also the Rails doc did not provide any instructions. All detailed instructions everywhere refer to Unicorn. I must not be the only one wanted to do http streaming over Apache and Passenger. Help please.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

似狗非友 2024-12-18 08:32:35

HTTP 流更正确的名称是分块传输编码

这些是我所知道的事情(可能还有更多要求):

Ruby 1.9.x

Streaming 需要 Ruby 1.9 的线程功能

兼容的中间件

您拥有的任何中间件都不得修改HTTP 响应

Passenger

Passenger_buffer_response 选项必须关闭

客户端支持

客户端必须宣传其使用 HTTP 1.1 或发送 TE 请求标头。

我依稀记得在某处读到需要 nginx,但我在任何地方都找不到参考。

我希望这有帮助。

HTTP Streaming is more correctly known as Chunked Transfer Encoding.

These are the things I know about (there may be more requirements):

Ruby 1.9.x

Streaming requires the threading features of Ruby 1.9

Compatible middleware

Any middleware you have must not modify the HTTP response

Passenger

The passenger_buffer_response option must be turned off

Client Support

The client must advertise it uses HTTP 1.1 or send the TE request header.

I vaguely recall reading somewhere that nginx was needed, but I cannot find the reference anywhere.

I hope that helps.

时间海 2024-12-18 08:32:35

我昨天刚刚在 Apache 下设置了带有响应流的 Passenger,没有遇到任何问题。这是我在 httpd.conf 中的虚拟主机配置:

<VirtualHost *:80>
  ServerName www.my.site.com
  DocumentRoot /var/rails/myapp/public    
  <Directory /var/rails/myapp/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
     # Enable response streaming
     PassengerBufferResponse off
  </Directory>
</VirtualHost>

I just set up Passenger under Apache with response streaming yesterday and had no trouble. Here is my virtual host config in httpd.conf:

<VirtualHost *:80>
  ServerName www.my.site.com
  DocumentRoot /var/rails/myapp/public    
  <Directory /var/rails/myapp/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews
     # Enable response streaming
     PassengerBufferResponse off
  </Directory>
</VirtualHost>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文