如何查找服务器频繁关闭的根本原因

How to find root cause for server shut down frequently

我正在使用 ubuntu apache。最近它经常关闭并在重新启动后重新打开。我一直在分析 apache2 错误日志以查找原因。以前它报告 PHP 代码错误。但是在修复它之后,它现在会抛出不同的错误。

根据这些错误我可以得出什么结论?哪个可能会导致停机以及如何解决?

AH: scoreboard is full, not at MaxRequestWorkers.Increase ServerLimit.
AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

AH00687: Negotiation: discovered file(s) matching request: /opt/bitnami/apps/file_that_doesn't-exist
(70007)The timeout specified has expired: [client 148.251.79.134:60170] AH01075: Error dispatching request to : (polling)

AH00045: child process 5062 still did not exit, sending a SIGTERM
AH00046: child process 5299 still did not exit, sending a SIGKILL
AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name

我进行了足够多的 google 搜索以了解每个错误。最重要的是,我想知道这些错误中的哪一个会导致服务器宕机?修复它的方法是什么?

这里是 Bitnami 工程师,

AH: scoreboard is full, not at MaxRequestWorkers.Increase ServerLimit.
AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

服务器似乎已达到极限,这可能是您 运行 遇到问题的原因。它可以达到限制,要么是因为实例非常小,你需要增加它的 memory/CPU,要么是因为你受到了攻击。

  • 您可以检查您是否受到运行这些命令的攻击
cd /opt/bitnami/apache2/logs/
tail -n 10000 access_log | awk '{print }'| sort| uniq -c| sort -nr| head -n 10

这些IP是不是很眼熟?是否有任何 IP 多次请求您的网站?

您可以找到有关如何阻止它的更多信息here

  • 您还可以通过编辑 /opt/bitnami/apache2/conf/bitnami/httpd.conf 文件来增加 Apache 中的 MaxRequestWorkers 参数,或者您也可以使用 AWS 控制台增加实例类型,以便服务器从现在开始拥有更多资源。