nginx nginx502状态 && nginx log recv() failed (104: Connection reset by peer)

      • 场景
      • 分析
      • 解决

场景

  • 在长耗时导出文件的时候 , 502错误; 分析nginx.log
    • 2018/08/09 14:27:12 [error] 29081#0: *9113790 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:

分析

  • 因为发现错误时在测试部门, 所以首先排除了代码的原因
  • 导致502的原因很多,所以需要分析nginx log, 但是比较常见的是 ‘处理超时’

解决

  • 测试部分(一台新机器)php-fpm的配置 request_terminate_timeout=60; 很明显不能满足导出文件的需要的时间
    • php-fpm.conf request_terminate_timeout=0
    • sudo kiill -USR2 php-fpm(matser process)

你可能感兴趣的:(php)