23decxf 发表于 2019-1-27 12:50:00

nginx网页报 cannot open more files的处理方法

1,内核级别
$ vi /etc/sysctl.conf
加上fs.file-max设置
fs.file-max = 100000
然后重新载入核心配置
$ sysctl -p
2,系统级别:修改etc/security/limits.conf中软限制和硬限制数。
* soft nofile 10240
* hard nofile 15360
其中第一行soft表示所有用户打开文件的数量限制为10240,如果超过这个数字则提示警告信息,但是依然可以打开文件。
第二行hard表示最大的打开文件数量不能超过15360,如果超过这个数字,则无法打开文件。
这里也可以针对具体的用户或者用户组进行相应的设定。例如针对nginx这个用户进行设定:
nginx soft nofile 10240
nginx hard nofile 15360


3,应用级别:修改nginx的配置文件添加work_rlimit_nofile=65535
  




页: [1]
查看完整版本: nginx网页报 cannot open more files的处理方法