1. 500 Internal Server Error

产生原因:主要是PHP执行脚本过程中产生致命的一些错误。

nginx error中的记录:

LNMP下返回500、502、504状态码分析

2. 502 Bad Gateway

产生原因:fpm挂掉nginx链接不上、fpm不再接受请求(请求打爆)、fpm 执行超时(request_terminate_timeout) 或者 fpm因为某些原因导致拒绝当前request的处理

nginx error log中的记录:

LNMP下返回500、502、504状态码分析

 此外要注意的是Nginx的upstream模块中的 max_fail 和 fail_timeout 两项。有时Nginx与上游服务器(如FastCGI)的通信只是偶然断掉了,但 max_fail 如果设置的比较小的话,那么在接下来的 fail_timeout时间内,Nginx都会认为上游服务器挂掉了,都会返回502错误。 所以可以将 max_fail 调大一些,将 fail_timeout 调小一些。

3. 504 Gateway Time-out

产生原因:fpm的请求处理时间超过了nginx中设置的timeout时间 fastcgi_connect_timeout 、 fastcgi_read_timeout 、fastcgi_send_timeout 这个是nginx是主动响应504

nginx error log中的记录:

LNMP下返回500、502、504状态码分析

 

相关文章:

  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-06-21
  • 2021-12-27
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案