2014/08/05 08:53:49 [alert] 13576#0: accept() failed (24: Too many open files)
方法一:只对root和nodbdy用户增加该值。
# vim /etc/security/limits.conf
root soft nofile 10240
root hard nofile 10240
nobody soft nofile 10240
nobody hard nofile 10240
方法二:对所有用户增加该值
# vim /etc/security/limits.conf
* soft nofile 655360
* hard nofile 655360
编辑nginx配置文件
# vim /usr/local/nginx/conf/nginx.conf
worker_rlimit_nofile 10240;
worker_connections 10240;
注意:需要重启系统
#lsof | wc -l
1465
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 3675
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 10240
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 3675
virtual memory (kbytes, -v) unlimited
file locks (-x
临时生效 : ulimit -n 10240, 将 系统可打开文件数量, 临时修改为 10240