小编rye*_*ead的帖子

防止 PHP-FPM 在轻负载下崩溃

我在我托管的 WordPress 网站上遭到 DoS 攻击。

173.192.109.118 - - [30/Sep/2015:22:31:36 +0000] "POST /xmlrpc.php HTTP/1.0" 499 0 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
Run Code Online (Sandbox Code Playgroud)

我在访问日志中收到大约 140 个这样的日志nginx(花费了大约 10 秒,所以每秒大约 14 个请求),然后它们切换到 502:

173.192.109.118 - - [30/Sep/2015:22:31:46 +0000] "POST /xmlrpc.php HTTP/1.0" 502 537 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
Run Code Online (Sandbox Code Playgroud)

此时,PHP-FPM必须重新启动才能恢复站点。

所以,我的问题是:我可以采取什么措施来防止单个攻击者崩溃PHP-FPM

我的大部分(有限)经验都是与 Apache 相关的,因此任何建议将不胜感激。

我试图对一切设定合理的限制。服务器在负载下有足够的 RAM,因此这似乎不是问题。我刚刚从以下教程中添加了一个速率限制器: https: //www.howtoforge.com/rate-limiting-with-nginx,虽然这似乎延迟了痛苦,但它仍然最终崩溃PHP-FPM

/var/log/php5-fpm.log除了当我忘记在配置文件中添加前导 / 时引入的几个错误以及重新启动后的一堆成功行之外,似乎没有显示任何有趣或有用的内容:

[30-Sep-2015 23:03:51] ERROR: Unable to create …
Run Code Online (Sandbox Code Playgroud)

nginx performance-tuning php-fpm

5
推荐指数
1
解决办法
2896
查看次数

标签 统计

nginx ×1

performance-tuning ×1

php-fpm ×1