Phenomenon:
PHP query database is slow, about 60s after Nginx return 504:sorry, the page you are looking for is currently unavailable.
Check log:
Find/var/log/nginx/access.log and/var/log/nginx/error.log from/etc/nginx/nginx.conf
Log display upstream timed out (110:connection timed out) while reading response headers from upstream
Workaround:
Nginx upstream timed out (what and how to fix)
Add a statement with comments
Location ~ \. php$ { # root html; fastcgi_read_timeout; # ####### #https://distinctplace.com/2017/04/22/nginx-upstream-timed-out/ upstream timed out (110: Connection timed out) while reading response headers from upstream fastcgi_pass 127.0.0.1:9000; Fastcgi_index index. php; Fastcgi_param script_filename $document _root$fastcgi_script_name; include fastcgi_params; }
After executing the service Nginx reload, execute the query, return to the page does not display table, continue to check log
"PHP message:php warning:file_get_contents (http://127.0.0.1/xxx): Failed to open stream:http request failed! In/home/www/uninum/web.php on line 50
PHP message:php notice:trying to get property of Non-object in xxx.php on line ' while reading response headers from U Pstream
Sync Settings file_get_contents Timeout
PHP file_get_contents Get file timeout processing and post and multiple retries
$opts Array ( ' http ' = =array( ' method ' = "GET", ' timeout ' =>300, ) ); $context stream_context_create ($opts); $html =file_get_contentsfalse$context
PHP query database is slow, nginx time-out returned 504:sorry, the page you were looking for is currently unavailable.