Too many open files
nginx出现错误Too many open files
可以通过命令查看系统打开文件数的限制
血的教训
编辑/etc/security/limits.conf在末尾添加如下内容
root soft nofile 1000000 root hard nofile 1000000
添加完效果如下
上面的配置适用于centos,对于Ubuntu无效 ,如果你是Ubuntu的话,这样:
root soft nofile 1000000 root hard nofile 1000000
用具体的用户名代替*
重新登录用户,配置就会生效
然后nginx的配置文件添加如下配置
worker_rlimit_nofile 10240; events { worker_connections 10240; }