Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx + PHP-FPM 502 Bad Gateway

Tags:

php

nginx

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.

like image 867
Andreas Avatar asked Sep 01 '10 08:09

Andreas


People also ask

Why do I get 502 bad gateway message?

A 502 bad gateway message indicates that one server got an invalid response from another. In essence, you've connected with some kind of interim device (like an edge server) that should fetch all of the bits you need to load the page. Something about that process went wrong, and the message indicates the problem.

What is PHP FPM used for?

Q: What is PHP-FPM used for? A: PHP-FPM (FastCGI Process Manager) is a web tool used to speed up the performance of a website. It is much faster than traditional CGI based methods and has the ability to handle tremendous loads simultaneously.


2 Answers

maybe http://pecl.php.net/bugs/bug.php?id=17689 or bug id #18138

like image 86
Rob Olmos Avatar answered Sep 20 '22 09:09

Rob Olmos


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.

like image 22
TML Avatar answered Sep 22 '22 09:09

TML