PHP query database is slow, nginx time-out returned 504:sorry, the page you were looking for is currently unavailable.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.