Home >Backend Development >PHP Tutorial >nginx 502 error collection nginx load balancing practical nginx nginx reverse generation

nginx 502 error collection nginx load balancing practical nginx nginx reverse generation

WBOY
WBOYOriginal
2016-07-29 08:52:361218browse

Nginx has a 502 Bad Gateway error.

I checked the Nginx error log and it is:

[html] view plain copy

  1. 2014/08/02 16:14:31 [error] 17029#0: *17941 recv() failed (10 4: Connection reset by peer) while reading response header from upstream, client: 210.61.12.2, server: blog.lixixphp.com, request: “POST /api/1.0 HTTP/1.1″, upstream: “fastcgi://127.0.0.1:9000″, host: “blog.lixixp.com”
  2. 2014/08/02 16:24:52 [error] 29615#0: *3 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 58.220.197.35, server : blog.lixixphp.com, request: “GET /404 HTTP/1.1″, upstream: “fastcgi://127.0.0.1:9000″, host: “blog.lixixphp.com”

Do not use The request_terminate_timeout of php-fpm is best set to request_terminate_timeout=0;

[html] view plain copy

  1. vi /etc/php-fpm.d/www.conf

[html] view plain copy

  1. ; The timeout for serving a single request after which the worker process will be killed. This option should be used when the 'max_execution_time' ini option
  2. ; does not stop script execution for some reason. A value of '0′ means 'off'.
  3. ; Available units: s(econds)(default), m(inutes), h(ours ), or d(ays)
  4. ; Default Value: 0
  5. Because this parameter will directly kill php process, and then restart the php process, so that the front-end nginx will return 104: Connection reset by peer. This process is very slow, and the overall feeling is that the website is stuck. The above introduces the nginx 502 error collection, including nginx and 502 content. I hope it will be helpful to friends who are interested in PHP tutorials.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn