使用 NGINX 反向代理下载 ~80kb 后 hang/fail

Downloads hang/fail after ~80kb using NGINX reverse proxy

我有一个远程反向代理 nginx 服务器,它向 apache 网络服务器提供流量。当用户尝试下载文件时,它会在大约 80-100kb 后停止,然后文件当然会损坏。

我假设这与保持活动状态有关,或者可能与最大进程有关。我试过调整很多参数都无济于事。请参阅下面的 nginx conf...

user www-data;
worker_processes 1;
pid /run/nginx.pid;

events {
    multi_accept on; #added, made no difference
    worker_connections  1024;
}


http {

    # Initialize Rate Limiting
    limit_req_zone $binary_remote_addr zone=login:10m rate=5r/s;

    # Sendfile issues maybe?
    sendfile_max_chunk 100M;
    client_max_body_size 100M;

    # Do Proxy Cache (Currently turned off, made no difference)
    # proxy_cache_path /data/nginx/cache keys_zone=one:10m loader_threshold=300 loader_files=200 max_size=200m;

    include /etc/nginx/sites-enabled/*;

    server {
            listen 80;
            server_name www.domain.com;
            return 301 $scheme://domain.com$request_uri;
    }

    server {
            listen 80;
            # proxy_cache one;
            server_name domain.com;
            access_log /var/www/proxy/log/nginx.access.log;
            error_log /var/www/proxy/log/nginx_error.log debug;

            location / {

                    # apply rate limiting
                    limit_req zone=login burst=20;

                    # download issue
                    max_ranges 0;

                    resolver        127.0.0.1;
                    include /etc/nginx/conf.d/proxy.conf;
                    proxy_pass      http://$host$request_uri;
            }

     }

还有我的proxy.conf

     proxy_redirect off;
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     client_max_body_size 20m;
     client_body_buffer_size 256k;
     proxy_connect_timeout 90s;
     proxy_send_timeout 90s;
     proxy_read_timeout 90s;
     proxy_buffers 32 4k;

在别处解决了问题 - 该问题与权限问题有关 https://serverfault.com/questions/736588/inconsistent-download-size-with-php-nginx-configuration