问题原文
原帖链接 · Muhammad Dyas Yaskur · CC BY-SA 4.0
Why my ec2 instance always timeout in about 60 seconds when I access http or https? After about 60 seconds always return:
Network Error (tcp_error)
A communication error occurred: "Operation timed out" The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
For assistance, contact your network support team.
and some times return:
Gateway Timeout
The gateway did not receive a timely response from the update server or application.
I use apache web server and PHP with max timeout. I dont use ELB/Load Balancer in my EC2, and I never create any ELB. I tried to find solution in internet but always found ELB setting.
已采纳解答
原帖链接 · Muhammad Dyas Yaskur · CC BY-SA 4.0
According this article I just need to run the command below
/sbin/sysctl -w net.ipv4.tcp_keepalive_time=200 net.ipv4.tcp_keepalive_intvl=200 net.ipv4.tcp_keepalive_probes=5
I tried and not working, but after I edited /etc/sysctl.conf and add following code:
net.ipv4.tcp_keepalive_time=200
net.ipv4.tcp_keepalive_intvl=200
net.ipv4.tcp_keepalive_probes=5
Then I rebooted my instance, and now the timeout is longer.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
