nginx提示:Too many open files解决办法
nginx提示:Too many open files这种错误问题的原因是因为linux文件系统最大可打开文件数为1024而你的nginx中的error.log出现大量的Too many open files,说明文件句柄不够用了所以就错误提示出来了。
如果nginx的error.log出现大量的Too many open files,说明文件句柄不够用了,这时候我们需要加大系统的文件句柄数和nginx的允许最大的连接数。
解决办法:
vi /etc/security/limits.conf 添加下面代码
* soft nofile 655360
* hard nofile 655360
修改nginx配置
worker_rlimit_nofile 10240;
worker_connections 10240;
重启nginx
message中出现 TCP: too many orphaned sockets
vim /etc/sysctl.conf添加下面代码(每个sockets 16K)
net.ipv4.tcp_max_orphans = 32768
执行下面代码生效
sysctl -p