Nginx + PHP-FPM 502 Bad Gateway

2019-01-26 04:48发布

I am getting a 502 Bad Gateway from Nginx on a line of PHP code that is working fine in other places of my program ($this->provider = new OAuthProvider();), and that have worked fine before. This is the message I get in the Nginx error log for each 502:

recv() failed (104: Connection reset by peer) while reading response header from upstream

In the PHP-FPM log there is a warning for each 502:

[WARNING] [pool www] child 17427 exited on signal 11 SIGSEGV after 142070.657176 seconds from start

After trying a number of changes to the nginx.conf I am stuck and would very much appreciate any pointers of what to do next.

I'm running Nginx 0.7.67 and PHP 5.3.2 on Ubuntu 10.04.

标签: php nginx
6条回答
来,给爷笑一个
2楼-- · 2019-01-26 04:53

Try to switch suhosin off. Sometimes it crashes Apache.

查看更多
We Are One
3楼-- · 2019-01-26 04:55

Your PHP process crashed with a segfault ("signal 11 SIGSEGV"), which caused Nginx to see "connection reset by peer" (PHP is the "peer" in this case, and Nginx is telling you "Look, he hung up on me before I could get an answer from him").

Check out the PHP Bug database page on how to report a bug someone will want to fix to find out how to get a backtrace of the segfault so you can report it.

查看更多
对你真心纯属浪费
4楼-- · 2019-01-26 05:09

I had similar problems with nginx/lighttpd + php-fcgi(using spawn-fcgi), do you use any opcode cache for php? What i found quite some time ago is that xcache was causing strange behaviour in php-fcgi, some php-fcgi processes randomly died, i was unable to find any pattern. I would recommend to take a look at apc(or other opcode cache) settings, if you are using any. Right now im using nginx + php-fpm on freebsd and have no problems.

查看更多
戒情不戒烟
5楼-- · 2019-01-26 05:10
Anthone
6楼-- · 2019-01-26 05:15

ZendOptimizer + APC + php-fpm 5.2.14 gives constantly reproducible SIGSEGV even on phpinfo();.

查看更多
Lonely孤独者°
7楼-- · 2019-01-26 05:16

i had the same problem with APC. so i removed it and installed eaccelerator instead. no problem so far.

查看更多
登录 后发表回答