Nginx + PHP-FPM 7.1 - 504 Gateway Time-out
The question is probably why does your backend take so long to respond? Not sure about your usecase but normally it's not user-friendly to wait to long for a response.
To answer your question:
I found this link: https://easyengine.io/tutorials/php/increase-script-execution-time/
Add in /etc/php5/fpm/php.ini
max_execution_time = 300
Set in /etc/php5/fpm/pool.d/www.conf
request_terminate_timeout = 300
Set in /etc/nginx/nginx.conf
http {
#...
fastcgi_read_timeout 300;
#...
}
And in your config:
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_read_timeout 300;
}
And reload services
service php5-fpm reload
service nginx reload
Nginx / PHP-FPM 504 Gateway Timeout
I almost completely gave up on this! However at the last minute I came up with the answer.
The servers are on Amazon AWS behind a load balancer. The load balancer had the idle-timeout attribute set at 60 seconds. Changing this setting fixed the problem!!
PHP-FPM served by Nginx: 504 Gateway Time-out - nginx
Looks like you need to increase fastcgi_read_timeout
in your nginx configuration.
Related Topics
How to Fix Server Status Code: 302 Found by SQL Inject Me Firefox Addon
How to Check If Value Already Exists in MySQL Database
PHP Require_Once Failed to Open Stream Permission Denied
How to Set PHP's Auto_Prepend_File Directive Per Directory
Get All Work Days in a Week for a Given Date
Mysql: Get Total in Last Row of MySQL Result
Echo a Multi Dimensional Array
Sort Array by Date in Descending Order by Date in PHP
Php: How to Add Leading Zeros/Zero Padding to Float via Sprintf()
PHP Replace All Spaces with Hyphens
How to Get Include Contents as a String
Why Don't PHP and JavaScript's Timestamps Match
How to Implement a Read-Only Member Variable in PHP
How to Use Multiple PHP Header Content Types on the Same Page? Is This Possible