Apache gegen DDoS schützen
Posted: 2008-02-20 12:09
Hallo!
Gestern verabschiedete sich der Server (AMD Athlon 64 X2 Dual Core, 8 GB, Apache 2 Prefork, PHP 4, MYSQL 5)... in den Error Logs steht folgendes:
Liegt es an der schlechten Konfiguration? Ich spiele gerade mit den Gedanken eine Firewall oder mod_evasive zu installieren... Was könnt ihr mir empfehlen? Wieso der Absturz? "free -m" zeigt immer ausreichenden Speicher an, d.h. kein Swappen, die CPU kann aber vermutlich nicht mithalten? Nachdem ich Apache neugestartet habe, konnte ich einen vorherigen Load von ca. 300 feststellen. Meine Vermutung: 85.114.x.x hat ziemlich viele Requests generiert, die offenbar sehr lange offen blieben... Aufgrund der hohen Anzahl hat er sich dann verabschiedet. Ists vl. besser KeepAlive auf Off zu stellen, um solche Ereignisse zu vermeiden? Mit mod_evasive gibts leider ein Bilder Problem, da jedes Einzelne als Request gezählt wird und daher Fotogallerien nicht funktionieren...
Jetzt, also nach dem Absturz, habe ich folgende Einstellungen:
ab auf die Seite liefert:
Wieso so viele Failed requests? Vielen Dank an für eure Hilfe ;-)
Gestern verabschiedete sich der Server (AMD Athlon 64 X2 Dual Core, 8 GB, Apache 2 Prefork, PHP 4, MYSQL 5)... in den Error Logs steht folgendes:
Code: Select all
[Tue Feb 19 19:14:19 2008] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Tue Feb 19 19:42:13 2008] [warn] child process 13315 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13256 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13426 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13467 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13276 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13330 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13403 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13355 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13366 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:13 2008] [warn] child process 13292 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13315 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13256 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13426 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13467 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13276 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13330 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13403 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13355 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13366 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:15 2008] [warn] child process 13292 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13315 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13256 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13426 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13467 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13276 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13330 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13403 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13355 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13366 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:17 2008] [warn] child process 13292 still did not exit, sending a SIGTERM
[Tue Feb 19 19:42:19 2008] [error] child process 13315 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13256 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13426 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13467 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13276 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13330 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13403 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13355 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13366 still did not exit, sending a SIGKILL
[Tue Feb 19 19:42:19 2008] [error] child process 13292 still did not exit, sending a SIGKILLCode: Select all
[Tue Feb 19 18:57:08 2008] [error] [client 85.114.x.x] File does not exist: /var/www/virtual/htdocs/bb
[Tue Feb 19 18:57:08 2008] [error] [client 85.114.x.x] File does not exist: /var/www/virtual/htdocs/forums
[Tue Feb 19 18:57:08 2008] [error] [client 85.114.x.x] File does not exist: /var/www/virtual/htdocs/communtiy
[Tue Feb 19 19:44:30 2008] [error] [client 82.54.x.x] request failed: error reading the headers
[Tue Feb 19 18:56:57 2008] [error] [client 85.114.x.29] File does not exist: /var/www/virtual/htdocs/phpmyadmin
[Tue Feb 19 18:56:58 2008] [error] [client 85.114.x.x] File does not exist: /var/www/virtual/htdocs/phpmyadmin0
[Tue Feb 19 18:56:58 2008] [error] [client 85.114.x.x] File does not exist: /var/www/virtual/htdocs/phpmyadmin1
[Tue Feb 19 18:56:58 2008] [error] [client 85.114.x.x] File does not exist: /var/www/virtual/htdocs/phpmyadmin2
...Jetzt, also nach dem Absturz, habe ich folgende Einstellungen:
Code: Select all
#
# Apache
#
<IfModule mpm_prefork_module>
StartServers 15
MinSpareServers 10
MaxSpareServers 20
ServerLimit 512
MaxClients 384
MaxRequestsPerChild 1000
</IfModule>
HostnameLookups Off
Timeout 45
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 2
#
# MySQL
#
key_buffer = 128M
max_connections = 200
table_cache = 512
sort_buffer = 15M
query_cache_limit = 1M
query_cache_size = 16MCode: Select all
Concurrency Level: 1
Time taken for tests: 122.876461 seconds
Complete requests: 1000
Failed requests: 905
(Connect: 0, Length: 905, Exceptions: 0)
Write errors: 0
Total transferred: 46326448 bytes
HTML transferred: 45990448 bytes
Requests per second: 8.14 [#/sec] (mean)
Time per request: 122.876 [ms] (mean)
Time per request: 122.876 [ms] (mean, across all concurrent requests)
Transfer rate: 368.17 [Kbytes/sec] received