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

Nee*_*eel 17 linux files debian nginx ulimit

我不断收到此错误nginx/error.log并让我发疯:

8096 worker_connections exceed open file resource limit: 1024
Run Code Online (Sandbox Code Playgroud)

我已经尝试了所有我能想到的方法,但无法弄清楚是什么限制了 nginx。你能告诉我我错过了什么吗?

nginx.conf 有这个:

worker_processes 4;
events {
        worker_connections 8096;
        multi_accept on;
        use epoll;
}
Run Code Online (Sandbox Code Playgroud)

security/limits.conf像这样更改了系统的 Ulimit :

# 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
Run Code Online (Sandbox Code Playgroud)

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

ULIMIT="-n 65535"
Run Code Online (Sandbox Code Playgroud)

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

我有 Debian 7 + nginx

Xav*_*cas 35

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

  • @Xavier 这确实删除了错误消息,但是您能否解释一下为什么它可以在不更改 ulimit 的情况下工作,如下面的答案中所述?谷歌搜索告诉我要更改limits.conf或systcl.conf中的ulimit,但没有一个对我有用。 (2认同)