-3

I just don't know why i got a 502 error. Please help. you can visit here http://upliu.net/phpinfo.php phpinfo.php just has one line code: phpinfo(); but i got a 502 bad gateway error someone can help ? thanks Here are my configure files:

https://github.com/upliu/some-files

I use ubuntu server 12.04.3

nginx 1.4

php 5.5.7 with fpm

Hello, I am very cleared that php-fpm service is running and nginx just works fine. I write a test code which only contains one line 'echo "hello";', it can run perfectly, but after i added a new line 'phpinfo();' , i got a 502 bad gateway error , i don't know why, anyone can help me ?

1 Answers1

1

the 502 bad gateway error is not a php error, it is a HTTP (nginx) error that means nginx was not able to hand off connection to a listener. assuming you are running php as fpm, make sure the master phpfpm process is running, and make sure it is listening on the same tcp port nginx is passing connections to. check your proxy_pass nginx configuration and make sure your backend php-fpm process pool is running. remember to look thru nginx error logs, and once you get past the 502, and can see the phpinfo(), check your php logs for more issues.

nandoP
  • 2,021
  • 14
  • 15
  • thank you.i have restart the fpm many times and php-fpm has no error log. nginx's error log just said recv() failed (104: Connection reset by peer) while reading response header from upstream – user1968677 Dec 18 '13 at 04:25
  • php-fpm does indeed have an error log, and it is configured via the "error_log" directive in php-fpm.conf. however, if you are still getting a 502, the connection is never making it to phpfpm, so there would be nothing there, until you fix the 502 issue....... double check the port you are passing the connection on... most likely you have a mismatch there – nandoP Dec 18 '13 at 16:53