大网数据广告活动
服务器运维问答

ec2 instance always timeout in about 60 seconds?

· 52CE 我爱测

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,…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-06-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。