How fastcgi temp works?

portoist nginx-forum at
Thu Jan 30 17:44:25 UTC 2014

Hello everybody,
We are using nginx with php-fpm. Our application works as download
aggregator. We download files from 3rd party servers and send it to client
while it's still being downloaded. It means that we can't use
X-Accel-Redirect, since file isn't fully downloaded and X-Accel-Redirect
sets Content-Length to actual file size. We set required headers in php and
in cycle read chunks of file, prints it and flush it to output. Everything
seems to work fine except large files (over 1GB) on slow download speeds.
Downloading was interrupted at 1GB - it seemed like client has disconnected
- calling connection_aborted in php returned true. I have found out that
fastcgi_max_temp_file_size is 1GB by default - so I have increased it to
Now how exactly does fastcgi temp file works? Does every request has its own
temp file? Or is there one common temp file?
Thanks for hints!

Posted at Nginx Forum:,247019,247019#msg-247019

More information about the nginx mailing list