How to get nginx to see higher limit for file descriptors?

Rt Ibmer rtibmx at yahoo.com
Fri Apr 25 21:39:52 MSD 2008


I am currently receiving this warning when nginx is started:
   [warn] 902#0: 4096 worker_connections are more than open file resource limit: 1024

Here is some quick background:

I am running on Fedora 8 core 2.6.x.  Originally if I opened a shell and typed "ulimit -n" it would come back with 1024.  If I manually entered "ulimit -n 65536" and then launched, nginx, the warning would go away.

So I figured I just needed to find a way to set the ulimit system wide at boot time.  After some Google searches I added this to my /etc/sysctl.conf file:
* soft nofile  65536 
* hard nofile  65536

Now when I reboot and launch a shell, when I type "ulimit -n" it comes back properly and shows 65536.

However, when my custom-made init.d script runs from a fresh boot, I still get a warning from nginx saying the limit is 1024.

So then I added "ulimit -n 65536" to my init.d script just prior to launching nginx, but this did not make a difference as I still get the warning.  I am launching nginx from the init.d script with a plain old /path/nginx -c configpath command. I also tried adding "daemon" in front of it but that didn't make any difference.

Can someone please let me know what I need to do to the config/environment so that nginx sees the 65536 available file descriptors instead of just 1024?  Thanks!






      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ






More information about the nginx mailing list