NGINX error 24 and worker_rlimit_nofile

mfigge

Member
Apr 24, 2007
7
0
151
We installed NGINX on cPanel 94 using the command line tool.
On a high traffic site (around 1000 concurrent visitors) we got several "24: Too many open files" errors
We increased the worker_rlimit_nofile parameter on nginx.conf to 3000
Is that the only change needed?
If I check the ulimit, the open files parameter is set to 4096

Thank you!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,810
895
313
cPanel Access Level
Root Administrator
Hey there! The Nginx documentation says the following about that value:

"Changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes. Used to increase the limit without restarting the main process."


If the error was specifically with Nginx and not an overall issue with a ulimit, that may be all you need to adjust to get things working.
 

mfigge

Member
Apr 24, 2007
7
0
151
Thank you for you reply.
How can I know if the problem was nginx or ulimit related?
I misstyped, right now worker_rlimit_nofile is 30000, and ulimit open files is 4096. I should increase that last one too?
I will do some stress test before the next event.
 

mfigge

Member
Apr 24, 2007
7
0
151
I realized that ulimits are a per user basis.
I checked the file limits.conf has
nginx soft nofile 30000
nginx hard nofile 50000
So actually nginx is able to open that quantity of files, right?
Sorry, I am newbie with nginx
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,810
895
313
cPanel Access Level
Root Administrator
I'm new to nginx as well, especially now that it's something we support :D

That's specifically what I was looking for - the nginx user limits. As long as that are in place I would expect it to be able to handle that number of files just fine now that you'd made the adjustment.
 
  • Like
Reactions: mfigge