Nginx提供的PHP-FPM:504网关超时-Nginx

用户名

我有一个PHP Android Push通知脚本。当我运行脚本时,在浏览器中收到以下响应“ 504网关超时nginx”。在常规日志概述中的服务器上,出现以下错误:

错误:504,消息:GET /gcm_test.php HTTP / 1.1,来源:nginx SSL访问

在我的服务器上proxy_error_log中,出现以下错误:

2016/07/25 08:18:19 [错误] 23882#0:* 4375上游超时(110:连接超时),同时从上游读取响应头,客户端:12.34.567.891,服务器:website.com,请求: “ GET /gcm_test.php HTTP / 1.1”,上游:“ fastcgi:// unix:///var/www/vhosts/system/website.com/php-fpm.sock”,主机:“ www.website.com ”

Android Push PHP脚本:

<?php
    // Replace with the real server API key from Google APIs
    $apiKey = "my apikey";

    // Replace with the real client registration IDs
    $registrationIDs = array("red id1", "reg id2");

    // Message to be sent
    $message = "Your message e.g. the title of post";

    // Set POST variables
    $url = 'https://gcm-http.googleapis.com/gcm/send';

    $fields = array(
        'registration_ids' => $registrationIDs,
        'data' => array( "message" => $message ),
    );
    $headers = array(
        'Authorization: key=' . $apiKey,
        'Content-Type: application/json'
    );

    // Open connection
    $ch = curl_init();

    // Set the URL, number of POST vars, POST data
    curl_setopt( $ch, CURLOPT_URL, $url);
    curl_setopt( $ch, CURLOPT_POST, true);
    curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
    //curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields));

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $fields));

    // Execute post
    $result = curl_exec($ch);

    // Close connection
    curl_close($ch);
    // print the result if you really need to print else neglate this
    echo $result;
?>

如果我替换行“ $ result = curl_exec($ ch);” 与“回声”脚本的结尾“;” 我没有收到任何错误,结果是“脚本结束”。因此,问题似乎出在“ $ result = curl_exec($ ch);”行中。

我还尝试了以下PLESK nginx 504错误:没有运气的网关超时

在服务器上,我正在运行PHP7.0.4作为Nginx提供的FPM应用程序

有人有什么想法吗?谢谢!

疯狂的乌鸦

看起来您需要增加fastcgi_read_timeoutnginx配置。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Wordpress-php-fpm中的超时504网关超时nginx

来自分类Dev

Nginx / GlassFish的504网关超时

来自分类Dev

nginx和uWSGI给出“ 504网关超时”

来自分类Dev

Django的Nginx 504网关超时错误

来自分类Dev

安装php curl后出现504网关超时/ 502网关错误-服务器Nginx

来自分类Dev

使用Django提供静态文件时,HTTP 504网关超时(Nginx + Gunicorn)

来自分类Dev

Nginx和Unicorn进行Rails部署会导致504网关超时错误

来自分类Dev

Nginx和PHP-FPM 502网关错误

来自分类Dev

Nginx和PHP-FPM 502网关错误

来自分类Dev

每分钟运行一次cron作业,nginx上发生504网关超时

来自分类Dev

Nginx 504使用php-fpm超时

来自分类Dev

nginx codeigniter 502网关错误

来自分类Dev

PHP fwrite()块到一个大文件/ 504网关超时

来自分类Dev

Django Nginx Gunicorn = 504超时

来自分类Dev

从Django开发服务器移至Nginx / uWSGI时网关超时504?

来自分类Dev

504网关超时-上游超时

来自分类Dev

504网关超时-上游超时

来自分类Dev

Nginx + PHP-FPM将.php文件作为下载文件提供

来自分类Dev

在 OpenSuse 上使用 Nginx 和 PHP-FPM 提供内联 PHP

来自分类Dev

PHP-FPM-Nginx-phpMyAdmin-502错误网关

来自分类Dev

502错误的网关nginx php7 fpm

来自分类Dev

ubuntu服务器重启后,nginx 502网关错误

来自分类Dev

php-fpm的Nginx错误

来自分类Dev

Nginx 504超时初始wordpress安装

来自分类Dev

如果正在进行流下载,Nginx PHP-FPM将不提供请求

来自分类Dev

更新后通过存储在php-fpm容器中的nginx提供新的静态文件

来自分类Dev

Nginx / PHP-FPM“访问被拒绝。” 错误

来自分类Dev

Nginx php-fpm子目录

来自分类Dev

Nginx + Php-fpm的延迟问题