nginx + php set large file upload request (Problem 502 and 504)

502 problem

  • php-fpm

Modify entry: 

request_terminate_timeout 

position:

eg: /etc/php5/fpm2/pool.d/www.conf
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_terminate_timeout = 300s

This comment illustrates, request_terminate_timeout apply when max_execution_time due time for any reason can not terminate the script, this will get rid of php-fpm request.
Look at the comments max_execution_time: This sets the maximum execution time of the script before the parser is allowed to abort, the default is 30s. It appears that my request should be max_execution_time This setting blown away.

 

  • php.ini

Modify entry:

  max_execution_time 

position:

eg: /etc/php5/fpm2/php.ini
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300
  • Restart

service php5-fpm restart

 

to sum up:

php web request 2 by controlling the execution time, one of the max_execution_time php.ini (SLEEP to be noted that, waits for a response time of the http request is not, there is a real count execution time), and the other is php- fpm request_terminate_timeout set, requests the start of this count is n seconds.

 


 

504 problem

Processing items:

  request_terminate_timeout

position:

  /etc/nginx/sites-enabled/default

  • Restart

/usr/sbin/nginx -s reload

 

参考地址:

https://blog.csdn.net/loophome/article/details/78604986

https://blog.csdn.net/lifei15731208550/article/details/89056867

Guess you like

Origin www.cnblogs.com/wanghaokun/p/11313887.html