简体   繁体   中英

Nginx: When is the fastcgi-proxy triggered? After request-header or after request-body is loaded?

Is the PHP setting max_input_time relevant, when having nginx as webserver in front?

The whole story:

Take the case that a visitor is uploading a file. The nginx webserver, listening on port 80, will get the request first.

Nginx itself has a client_header_timeout setting, which should not be that relevant since file-uploads are handled in the request body. The client_body_timeout is the maximum amount of time, the client can send this request-body, containing the file and some other POST data. The size of this data can be limited by client_max_body_size, right?

PHP now waits for the data. This time is limited by max_input_time. And when it has all the data, it checks that the request-body does not exceed it's post_max_size limitation, parses it and checks, that the file does not exceed the upload_max_filesize limitation. And now the php-script will be executed, which should not take longer than max_execution_time.

But when does my fastcgi-proxy get loaded? Is it after the request-header is loaded, after the request-body is loaded or when does it get triggered?

Or ... put this question another way: Is the PHP configuration max_input_time relevant at all, when I have PHP running using PHP-FPM, backed by an nginx webserver? Do I have to increase this value when the vistor has a bad bandwidth but wants to upload a huge file, or is it enough to increase the nginx setting for client_body_timeout?

Please correct me if the assumption is not correct!

Just to give an answer, that's convenient for me:

I tried to upload a 18MB file and I got it within 50sec. The fastcgi-proxy was limited to 10sec. So, for me, it seems that nginx is caching the whole request before it sends it to the fastcgi-proxy.

So, to have it short: No. I don't need to exceed the max_input_time in my case.

This may vary from configuration to configuration. It would be fine to have someone who knows the code and can tell which options this depends on.

On IRC, nobody could really tell me, when nginx sends the data to the fastcgi-proxy ...

EDIT:

Just wanted to add another resource, that confirms my suggestion here:

Unfortunately PHP gets the data only after the upload is completed and [...]

See the accepted answer in Does session upload progress work with nginx and php-fpm?

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