Skip to content
Advertisement

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

I have a remote reverse proxy nginx server that feeds traffic to an apache web server. When a user attempts to download a file, it stops after approximately 80-100kb, and then the file is of course corrupted.

I’m assuming this has something to do with keep alive, or possibly max processes or something. I’ve tried adjusting many of the parameters to no avail. Please see nginx conf below…

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;
            }

     }

And my 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;

Advertisement

Answer

Solved the issue elsewhere – the problem was related to a permissions issue https://serverfault.com/questions/736588/inconsistent-download-size-with-php-nginx-configuration

Advertisement