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.
In your apache/vhost config you need to set the Timeout directive to the desired timeout value.
https://httpd.apache.org/docs/2.4/mod/core.html#timeout
According this article I just need to run the command below
I tried and not working, but after I edited
/etc/sysctl.conf
and add following code:Then I rebooted my instance, and now the timeout is longer.