nginx uLimit'worker_connections超过打开的文件资源限制:1024'

我不断收到这个错误在nginx/error.log和它驱使我nginx/error.log了:

 8096 worker_connections exceed open file resource limit: 1024 

我已经尝试了所有我能想到的东西,并且无法弄清楚在这里限制nginx的是什么。 你能告诉我错过了什么吗?

nginx.conf有这个:

 worker_processes 4; events { worker_connections 8096; multi_accept on; use epoll; } 

我改变了我的系统的ulimit security/limits.conf像这样:

 # This is added for Open File Limit Increase * hard nofile 199680 * soft nofile 65535 root hard nofile 65536 root soft nofile 32768 # This is added for Nginx User nginx hard nofile 199680 nginx soft nofile 65535 

它仍然显示错误。 所以我也尝试编辑/etc/default/nginx并添加下面这行:

 ULIMIT="-n 65535" 

它仍然显示相同的错误。 无法弄清楚是什么限制nginx工作连接只有1024.你能指出我吗?

我有Debian 7 + nginx

设置worker_rlimit_nofile 65535; 在主要上下文中的nginx.conf中。

成为用户:

 su - nginx 

检查限制:

 ulimit -Hn ulimit -Sn 

编辑文件系统允许您打开的文件数量:

 vi /etc/sysctl.conf fs.file-max = 70000 

加载您的更改:

 sysctl -p 

看看是否有帮助。