简体   繁体   English

连接Facebook Graph API时,PHP上的ElasticBeanstalk上的504网关超时

[英]504 Gateway Timeout on ElasticBeanstalk for PHP when connecting Facebook Graph API

When a user connects to my web app using their Facebook login, the server wouldn't redirect back because of the 504 error it got caught along the way. 当用户使用他们的Facebook登录连接到我的网络应用程序时,服务器不会重定向回来,因为它在途中遇到了504错误。

It works normally in my local testing environment, but it has that problem on my staging server where I use Amazon Elastic Beanstalk as a platform. 它在我的本地测试环境中正常工作,但是在我使用Amazon Elastic Beanstalk作为平台的登台服务器上存在这个问题。

Any idea how I could fix that? 知道如何解决这个问题吗?

From http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ts-elb-error-message.html 来自http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ts-elb-error-message.html

Description: Indicates that the load balancer closed a connection because a request did not complete within the idle timeout period. 说明:表示负载均衡器关闭了连接,因为请求未在空闲超时期限内完成。

Cause 1: The application takes longer to respond than the configured idle timeout. 原因1:应用程序响应时间比配置的空闲超时时间长。

Solution 1: Monitor the HTTPCode_ELB_5XX and Latency CloudWatch metrics. 解决方案1:监控HTTPCode_ELB_5XX和Latency CloudWatch指标。 If there is an increase in these metrics, it could be due to the application not responding within the idle timeout period. 如果这些指标有所增加,可能是由于应用程序在空闲超时期限内没有响应。 For details about the requests that are timing out, enable access logs on the load balancer and review the 504 response codes in the logs that are generated by Elastic Load Balancing. 有关超时请求的详细信息,请在负载均衡器上启用访问日志,并查看Elastic Load Balancing生成的日志中的504响应代码。 If necessary, you can increase your back-end capacity or increase the configured idle timeout so that lengthy operations (such as uploading a large file) can complete. 如有必要,您可以增加后端容量或增加配置的空闲超时,以便完成冗长的操作(例如上载大文件)。

Cause 2: Registered instances closing the connection to Elastic Load Balancing. 原因2:已注册的实例关闭与Elastic Load Balancing的连接。

Solution 2: Enable keep-alive settings on your EC2 instances and set the keep-alive timeout to greater than or equal to the idle timeout settings of your load balancer. 解决方案2:在EC2实例上启用保持活动设置,并将保持活动超时设置为大于或等于负载均衡器的空闲超时设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM