【问题标题】:Apache - Website timeout after random time ( Fore to restart Apache )Apache - 随机时间后网站超时(重新启动 Apache)
【发布时间】:2018-01-22 15:50:23
【问题描述】:

你好 stackoverflow 社区,

我的 Apache 服务器有一个大问题。

(现在我用谷歌翻译来留言)

由于我还不知道的原因,我的 Apache2 服务器随机开始停止响应(错误 500)。

当问题发生时,我注意到了一些东西,在文件“error.log”中,我总是找到这一行:

[Mon Aug 14 18:42:39.917495 2017] [mpm_prefork:error] [pid 23163] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

在那之后,我要求更改值“MaxRequestWorkers”,但它没有改变任何东西,问题仍然存在。

我也注意到,一般来说,当问题发生时,它是跟随一个强请求吸 Apache 服务器(特别是 最后,原始的强制攻击),带有这些日志(access.log):

http://p.hexicans.eu/MMgRunkXQX

在“error.log”文件中,我也记录了很多这样的错误:

[Mon Aug 14 18:28:58.366861 2017] [core:warn] [pid 20916] AH00045: child process 22399 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366873 2017] [core:warn] [pid 20916] AH00045: child process 22401 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366883 2017] [core:warn] [pid 20916] AH00045: child process 22402 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366890 2017] [core:warn] [pid 20916] AH00045: child process 22425 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366898 2017] [core:warn] [pid 20916] AH00045: child process 22428 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366910 2017] [core:warn] [pid 20916] AH00045: child process 22451 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366923 2017] [core:warn] [pid 20916] AH00045: child process 22456 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366965 2017] [core:warn] [pid 20916] AH00045: child process 22460 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366981 2017] [core:warn] [pid 20916] AH00045: child process 22466 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366990 2017] [core:warn] [pid 20916] AH00045: child process 22468 still did not exit, sending a SIGTERM
[Mon Aug 14 18:28:58.366997 2017] [core:warn] [pid 20916] AH00045: child process 22469 still did not exit, sending a SIGTERM

我已经花了很多时间寻找解决方案,但到目前为止我还没有找到它,这就是我前往这个论坛的原因^^

我的实际“/etc/apache2/mods-enabled/mpm_prefork.conf”文件:

<IfModule mpm_prefork_module>
        ServerLimit              500
        StartServers             10
        MinSpareServers          10
        MaxSpareServers          400
        MaxRequestWorkers        256
        MaxConnectionsPerChild   0
        KeepAlive                Off
</IfModule>

其他信息:

  • 操作系统:Ubuntu 16.04.3 LTS
  • Apache:Apache/2.4.18 (Ubuntu)
  • PHP:Zend Engine v3.0.0,版权所有 (c) 1998-2017

提前感谢您的帮助!

【问题讨论】:

  • 哼,没有想法? ^^

标签: php apache ubuntu timeout apache2


【解决方案1】:

MaxRequestWorkers 指令设置将同时处理的请求数的限制。任何超过 MaxRequestWorkers 限制的连接尝试通常都将排队,最多基于 ListenBacklog 指令的数量。一旦在不同请求结束时释放子进程,就会为连接提供服务。

MaxRequestWorkers 转换为将启动以服务请求的最大子进程数。默认值为 256;要增加它,您还必须提高 ServerLimit。

【讨论】:

  • 嗯,我已经将“ServerLimit”参数设置为 500 ...但是如何计算“MaxRequestWorkers”与“ServerLimit”?
  • 嗯,不知道.. ?
【解决方案2】:

之前,我只是注意到一些事情,

该问题仅出现在非 HTTPS 的网站上(并在几个小时后离开)。

【讨论】:

    猜你喜欢
    • 2019-05-07
    • 1970-01-01
    • 2015-11-03
    • 1970-01-01
    • 2020-09-14
    • 2011-05-11
    • 1970-01-01
    • 2017-08-17
    • 1970-01-01
    相关资源
    最近更新 更多