dt2015 2015-09-03 13:35
浏览 66

特定路由上的Nginx Bad Gateway错误

I'm using Nginx + PHP-FPM and on some routes I receive a 502 Bad Gateway error. When I dd('test') it will return the text inside the dd(). The text isn't received inside the Controller constructor so the error is probably happening after route dispatching.

When I look at the logs it does return this error:

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"

I've added catch_workers_output = yes to the /etc/php5/fpm/pool.d/default.conf file, but nothing changes.

My /etc/php5/fpm/pool.d/default.conf file looks like this:

[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

My /etc/nginx/host.d/default.conf file looks like this:

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;
}

What could be the issue? It's really strange that the error in on specific routes.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
    • ¥20 关于URL获取的参数,无法执行二选一查询
    • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集