Gateway Timeout 错误
Gateway Timeout - The gateway did not receive a timely response from the upstream server or application.
解决办法
修改 Apache 配置文件,将 Apache 的 Timeout 时间延长。
vi /usr/local/apache/conf/httpd.conf
修改
#Include conf/extra/httpd-default.conf
为
Include conf/extra/httpd-default.conf
然后再修改 httpd-default.conf 文件:
vi /usr/local/apache/conf/extra/httpd-default.conf
修改
Timeout 60
为
Timeout 300
修改完成后重启 Apache 服务即可。
思路说明
Apache 的 Timeout 参数控制着等待 TCP 数据包的时间。当 PHP 等后端程序执行时间较长时,如果超过了 Timeout 设定的值,Apache 就会返回 504 Gateway Timeout 错误。通过将 Timeout 从默认的 60 秒延长到 300 秒,可以给后端程序更长的执行时间,避免因超时而中断正常请求。

发表评论 取消回复