linux - 使用 NGINX 反向代理下载约 80kb 后挂起/失败

标签 linux apache nginx proxy 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

关于linux - 使用 NGINX 反向代理下载约 80kb 后挂起/失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28282332/

相关文章:

linux - ffmpeg 无法连接来自两个不同设备的电影

c - 原始套接字 : inappropriate ioctl

caching - kubernetes nginx 入口 Controller /缓存静态 Assets

nginx - React-router 和 nginx

nginx - 如何在 ubuntu 中使用 nginx 获取域名而不是 ip 地址?

linux - 使用命令 "-d"和 "-cp."时出现 Javac 无效标志错误

linux - 排序文件仅获取行最大值

python - Apache SetEnv 未按预期与 mod_wsgi 一起工作

apache - 配置 apache2 和主机以使用 nginx 将流量传递到 docker 容器

apache - 使用两个环境变量来阻止 Apache .htaccess 中的访问