简体   繁体   中英

NGINX: Download stops after 1GB - upstream timed out (110: Connection timed out)

i have a huge Problem on my site. Please help me to fix it.

i have a site where users can download files from different other sites (fe one-click-hoster like uploaded.net). We act as like a proxy. The user generate a link and download the file directly. Our Script download nothing on the server. A little bit like a premium link generator but different. AND NOT ILLEGAL.

If the user are downloading a file that is larger than 1GB, the download will be canceled when it reachs 1gb.

In the log files i found repeated the error "Upstream timed out (110: Connection timed out) while reading response"

I have tried to put the settings higher but that didn't help.

I tried following:

1. nginx.conf:
   fastcgi_send_timeout 300s;
   fastcgi_read_timeout 300s;

2. nginx host file:
   fastcgi_read_timeout 300;
   fastcgi_buffers 8 128k;
   fstcgi_buffer_size 256k;

3. PHP.ini:
   max_execution_time = 60 (but my php script will set it automaticly to 0)
   max_input_time = 60
   memory_limit = 128M

4. PHP-FPM >> www.conf
   pm.max_children = 25
   pm.start_servers = 2
   pm.min_spare_servers = 2
   pm.max_spare_servers = 12
   request_terminate_timeout = 300s

But nothing helps. What can i do to fix this problem?

Server/Nginx Infos:
Memory: 32079MB
CPU: model name: Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz (8 Cores)
PHP: PHP 5.5.15-1~dotdeb.1 (cli) (built: Jul 24 2014 16:44:04)
NGINX: nginx/1.2.1

nginx.conf:
worker_processes  8;
worker_connections  2048;

But time settings are doens't matter i think. Because the download stops exactly on 1.604.408 KB everytime. If i download with 20kb/s the download needs more time, but will cancel on exactly 1.604.408 KB.

thank you for any help. If you need more informations please ask me.

i had similar problem, where download would stop at 1024MB with error

readv() failed (104: Connection reset by peer) while reading upstream

adding this to nginx.conf file helped:

fastcgi_max_temp_file_size 1024m;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM