特定路由上的Nginx Bad Gateway错误

时间:2015-09-03 13:35:03

标签: php laravel nginx laravel-5

我正在使用Nginx + PHP-FPM,在某些路由上我收到502 Bad Gateway错误。 当我dd('test')时,它会返回dd()内的文字。在Controller构造函数中没有收到文本,因此错误可能发生在路由调度之后。

当我查看日志时,确实会返回此错误:

2015/09/03 13:28:35 [error] 18#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.59.3, server: _, request: "GET /v2/topics/4/timeline HTTP/1.1", upstream: "fastcgi://unix:/run/php5-fpm.sock:", host: "192.168.59.103:8080"

我已将catch_workers_output = yes添加到/etc/php5/fpm/pool.d/default.conf文件,但没有任何变化。

我的/etc/php5/fpm/pool.d/default.conf文件如下所示:

[default]
user = core
group = core
listen = /run/php5-fpm.sock
listen.owner = core
pm = ondemand
pm.max_children = 4
php_value[max_execution_time] = 120
php_value[post_max_size] = 256M
php_value[upload_max_filesize] = 256M
include = /data/config/php-*.conf
catch_workers_output = yes

我的/etc/nginx/host.d/default.conf文件如下所示:

server {
        listen          80 default_server;
    listen   [::]:80 default_server ipv6only=on;

    server_name     _;

        root            /www/public;
        index           index.php index.html index.htm;

    location / {
             try_files $uri $uri/ /index.php?$query_string;
        }

    location = /favicon.ico {
         log_not_found off;
    }

        location ~ \.php$ {
             try_files $uri /index.php =404;
             fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_pass unix:/run/php5-fpm.sock;
             fastcgi_index index.php;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             include fastcgi_params;
        }

    rewrite_log on;
        access_log      /var/log/nginx/default_access.log;
        error_log       /var/log/nginx/default_error.log notice;
}

可能是什么问题?特定路线上的错误真的很奇怪。

0 个答案:

没有答案