Nginx 502 Error Collection Nginx load balancing in real----Nginx reverse generation

Source: Internet
Author: User
Tags stop script connection reset nginx load balancing
Nginx appears 502 bad Gateway error,

The error log for Nginx has been checked:

[HTML] View plaincopy

    1. 2014/08/02 16:14:31 [ERROR] 17029#0: *17941 recv () failed (104:connection reset by peer) while reading response header fr Om upstream, client:210.61.12.2, server:blog.lixiphp.com, Request: "post/api/1.0 Http/1.1″, upstream:" fastcgi://127.0 .0.1:9000″, Host: "Blog.lixiphp.com"
    2. 2014/08/02 16:24:52 [ERROR] 29615#0: * RECV () failed (104:connection reset by peer) and reading response header from U Pstream, client:58.220.197.35, server:blog.lixiphp.com, Request: "Get/404 Http/1.1″, upstream:" fastcgi:// 127.0.0.1:9000″, Host: "Blog.lixiphp.com"


Do not use PHP-FPM request_terminate_timeout, preferably set to request_terminate_timeout=0;

[HTML] View plaincopy

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

[HTML] View plaincopy

    1. ; The timeout for serving a single request after which the worker process would
    2. ; Be killed. This option should is used when the ' max_execution_time ' ini option
    3. ; Does not a stop script execution for some reason. A value of ' 0′means ' off '.
    4. ; Available units:s (econds) (default), M (inutes), H (ours), or D (ays)
    5. ; Default value:0
    6. Request_terminate_timeout = 0


Because this parameter will directly kill the 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, the overall feeling is that the website is very card.

The above describes the Nginx 502 error collection, including the nginx,502 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.