-
Notifications
You must be signed in to change notification settings - Fork 2
Slowloris
netstat -nalt | grep :80 | grep ESTA -c
zählt aktive Verbindungen
netstat -nalt | grep :80 | grep ESTA
gibt die VErbindungen aus
liegt bei /etc/nginx/nginx.conf
anpassen von
events {
worker_connections 768;
}
zu
events {
worker_connections 100000;
}
überprüfen mit
cat /proc/sys/fs/file-max
max@webbaki-entwicklung:/etc/nginx$ cat /proc/sys/fs/file-max
9223372036854775807
ist groß genug...
Wenn nicht, dann in
/etc/sysctl.conf
auf
fs.file-max = 500000
setzen
in www-data console gehen; hat keine shell, deshalb das -s
sudo su - www-data -s /bin/bash
Limit:
ulimit -n
Hard Limit:
ulimit -Hn
Soft Limit:
ulimit -Sn
Normalerweise ist das Soft Limit bei 1024 und das Hard Limit bei 4096.
Wenn ja, dann unter
/etc/security/limits.conf
anheben auf:
* soft nofile 102400
* hard nofile 409600
www-data soft nofile 102400
www-data hard nofile 409600
nginx limitiert die Anzahl der open files auch ... also anpassen
ps aux | grep nginx
dann kommt etwas ähnliches wie das raus:
root 1095 0.0 0.0 85880 1336 ? Ss 18:30 0:00 nginx: master process /usr/sbin/nginx
www-data 1096 0.0 0.0 86224 1764 ? S 18:30 0:00 nginx: worker process
www-data 1097 0.0 0.0 86224 1764 ? S 18:30 0:00 nginx: worker process
www-data 1098 0.0 0.0 86224 1764 ? S 18:30 0:00 nginx: worker process
www-data 1099 0.0 0.0 86224 1764 ? S 18:30 0:00 nginx: worker process
Eine www-data id nehmen (z.B. 1095) und benutzen:
cat /proc/1096/limits
Max open files 1024 4096 files
Max open files ist noch bei 1024
/etc/nginx/nginx.conf
worker_rlimit_nofile 102400;
einfügen
Sollte ungefähr so aussehen:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
worker_rlimit_nofile 102400;
events{ ...
unbedingt am Anfang vor den envents eintragen.