我有一个强大的服务器,配有 64GB 内存、出色的网络和 SSD,可实现快速连接,但有人(我不知道为什么)攻击了我的网站,似乎是一个脚本,它经常请求我的 index.php 页面,导致我的 MySQL 不稳定,即使我的服务器使用了良好的硬件配置。检查我的日志文件:
[Fri Nov 06 13:02:47.169346 2020] [proxy_fcgi:error] [pid 30232:tid 140367357691648] [client 164.68.100.114:35336] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.169560 2020] [proxy_fcgi:error] [pid 29914:tid 140366971922176] [client 164.68.100.114:33102] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.170482 2020] [proxy_fcgi:error] [pid 29692:tid 140364547610368] [client 164.68.100.114:2658] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.168929 2020] [proxy_fcgi:error] [pid 30229:tid 140366980314880] [client 164.68.100.114:40178] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.169336 2020] [proxy_fcgi:error] [pid 30229:tid 140366946744064] [client 164.68.100.114:2841] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.186088 2020] [proxy_fcgi:error] [pid 30229:tid 140367483582208] [client 164.68.100.114:39838] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.186853 2020] [proxy_fcgi:error] [pid 30229:tid 140367089354496] [client 164.68.100.114:2591] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.187609 2020] [proxy_fcgi:error] [pid 30229:tid 140367097747200] [client 164.68.100.114:2609] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.188884 2020] [proxy_fcgi:error] [pid 30229:tid 140366837704448] [client 164.68.100.114:3360] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190061 2020] [proxy_fcgi:error] [pid 30229:tid 140366946744064] [client 164.68.100.114:2841] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190768 2020] [proxy_fcgi:error] [pid 30230:tid 140367475189504] [client 164.68.100.114:3624] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190043 2020] [proxy_fcgi:error] [pid 30230:tid 140366611199744] [client 164.68.100.114:40394] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190882 2020] [proxy_fcgi:error] [pid 30230:tid 140366468523776] [client 164.68.100.114:40390] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190880 2020] [proxy_fcgi:error] [pid 30229:tid 140367114532608] [client 164.68.100.114:3085] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190894 2020] [proxy_fcgi:error] [pid 29692:tid 140364556003072] [client 164.68.100.114:33944] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190051 2020] [proxy_fcgi:error] [pid 30230:tid 140366544058112] [client 164.68.100.114:40392] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190914 2020] [proxy_fcgi:error] [pid 30229:tid 140365092873984] [client 164.68.100.114:33844] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.188394 2020] [proxy_fcgi:error] [pid 30230:tid 140366493701888] [client 164.68.100.114:40396] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.191808 2020] [proxy_fcgi:error] [pid 30229:tid 140365076088576] [client 164.68.100.114:40402] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190599 2020] [proxy_fcgi:error] [pid 30230:tid 140366560843520] [client 164.68.100.114:40386] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.190959 2020] [proxy_fcgi:error] [pid 30230:tid 140366577628928] [client 164.68.100.114:40388] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.192573 2020] [proxy_fcgi:error] [pid 30229:tid 140367466796800] [client 164.68.100.114:60224] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
[Fri Nov 06 13:02:47.193573 2020] [proxy_fcgi:error] [pid 30229:tid 140366846097152] [client 164.68.100.114:60192] AH01071: Got error 'PHP message: PHP Warning: mysqli::__construct(): (08004/1040): Too many connections in /var/www/master/database.php on line 19\n'
我该如何阻止这种情况?深入分析日志后发现,所有请求都是基于 HEAD 方法的。如果我阻止网站的 HEAD 请求,我会遇到任何问题或与 Google 机器人有关的问题吗?我不知道这是否是一种解决方案,似乎是一种技巧。此外,我正在使用 Cloudflare,但这种攻击仍然存在。我该怎么办?
谢谢。