###问题发生的背景:
合作方请求某个接口,由于处理时间较长,导致了网关超时.

###问题分析:
1.可能是php程序超时报错;
2.php-fpm处理请求超时;
3.nginx服务器超时.

###问题解决:
1.php超时设置:
检查了php超时的配置,在php.ini里面:max_execution_time, 配置为300s,结果还是一样报了504超时.

2.查阅资料后,觉得可能是nginx代理超时,将nginx.conf或者vhost中的配置文件中加入设置的代理时长,结果还是没起作用:  
proxy_connect_timeout       300s;
proxy_send_timeout          300s;
proxy_read_timeout          300s;
send_timeout                300s;  

3.最后设置了fastcgi的超时配置,重启nginx就可以了.
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
如果以后再遇到超时504的错误,也可以按照这几个参数进行配置.

 

相关文章:

  • 2021-12-09
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
  • 2022-01-12
  • 2021-09-18
猜你喜欢
  • 2022-03-06
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-12-11
相关资源
相似解决方案