504 Gateway Timeout 异常

生产销售系统出现 504 Gateway Timeout 异常,其实就是服务器响应太慢导致nginx带来超时,先不说服务端慢的优化问题;只是单纯的解决504。到网上发现了一篇文章fix it

Add these variables to nginx.conf file:

proxy_connect_timeout       600;
  proxy_send_timeout          600;
  proxy_read_timeout          600;
  send_timeout                600;

Then restart nginx:

service nginx reload

Nginx returns empty response on long URL - (failed) net::ERR_EMPTY_RESPONSE

nginx 返回的数据量大+反应时间过程会导致这个问题。

查询特别耗时,高达6分钟

最后查明,开发人员在for循环中查询sql导致数据库压力巨大,查询速度非常慢,将sql提取出统一查询,问题解决!

原文地址:https://www.cnblogs.com/kesimin/p/11017360.html