dongzhanlian6289 2016-11-22 23:55
浏览 53

发送大文件的NGINX在某些情况下不会发送所有数据

I have a simple movie file(mkv) that i'm sending over nginx.

My Nginx Config is the following

user  nginx;
worker_processes  auto;

worker_rlimit_nofile 300000;
events {
    worker_connections  16000;
    use epoll;
    accept_mutex on;
}

http {

    include       mime.types;
    default_type  application/octet-stream;

    sendfile           on;
    tcp_nopush         on;
    tcp_nodelay        on;
    gzip off;

    access_log off;
    keepalive_timeout 10;
    client_max_body_size 0;

    server {
        listen 5050;
        index index.html index.htm;
        root /var/www/;
        server_tokens off;
        chunked_transfer_encoding off;

        if ( $request_method !~ ^(GET|POST)$ ) {
            return 200;
        }

    }
}

If i try to download the movie from a fast connection (for example with wget from a server) the movie is being downloaded successfully.

If i try to fetch the movie using slower connection, for example using ffmpeg with the -re argument (native frames), it will only download the half of the movie. The same of course happens if i use wget and adjust the download speed to be much lower than the normal one.

The connection from nginx closes after some time without sending the whole file, and i dont understand why this is happening and why it doesn't happen if i have a fast connection.

EDIT

i Edit my post entirely, because after running some tests i find out that the issue is coming from NGINX, and not from PHP as the connection was still closing after fetching the movie directly from nginx.

  • 写回答

1条回答 默认 最新

  • doutang3077 2016-11-23 00:11
    关注

    From what you said in the beginning, this seems to be a problem with set_time_limit(), try to increase the value, make sure that you can adjust this value, some servers don't allow this.

    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探