Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is setting the right value of worker_rlimit_nofile in nginx.conf enough solve the issue of Too many open files in nginx?

Or do I still need to update the sysctl.conf and limits.conf?

share|improve this question
up vote 4 down vote accepted

In Linux, you can see if that option has changed the limits of the process by running:

cat /proc/<PID>/limits

Where <PID> is the process ID of nginex. Test on a development environment.

If that option is not changing the limits or if you have a too restrictive hard limit you need to change the nofile in the /etc/security/limits.conf file.

share|improve this answer

I do not think you need to modify limits.conf. The point of worker_rlimit_nofile is to provide a quick and dirty way to do this via RLIMIT_NOFILE.

However, there are hard system limits set by the OS which you may need to override using sysctl.conf.

In practice, I usually set my fs.file-max in sysctl to about 4X the rlimit for my apps. No basis for this other than I never want something to fail due to hitting this limit. And a 2-4X range is usually sufficiently high to only trigger when there's a major issue with the apps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.