曲径通幽论坛

标题: 允许 sendfile 方式传输文件 [打印本页]

作者: beyes    时间: 2015-8-6 22:09
标题: 允许 sendfile 方式传输文件
在 Apache,lighttd 等 web 服务器配置中,都有和 sendfile 相关的配置。

在 Nginx 中, sendfile 的语法格式为:
  1. sendfile on | off;
复制代码

用于开启或关闭 sendfile() 传输文件(关于 sendfile 的概念,详见本论坛的其它帖子)。默认值为 off ,可以在 http 块,server 块 或者 location 快中进行配置。

与 sendfile 相关的一个指令是 sendfile_max_chunk ,语法格式为:
  1. sendfile_max_chunk size;
复制代码

如果 size 值大于 0,Ngnix 进程的每个 worker process 每次调用 sendfile() 传输的数据量最大不能超过这个值;如果设置为 0,则无限制;默认值为 0 。该指令可以在 http 块,server 块 或者 location 块中配置。
  1. sendfile_max_chunk 128K;
复制代码







欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2