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

Manlio Perillo manlio_perillo at
Sat Apr 26 01:23:57 MSD 2008

Rt Ibmer ha scritto:
>> No, it's the number of file descriptors allowed for a process; I cannot imagine
>> 4096 workers (and the swap size!) ;-)
> Correct. That is what I meant. I am trying to set the environment so that there are plenty of file descriptors available for nginx's use. 1024 seems rather low for the heavy traffic we will be handling.
> I can successfully use unlimit -n 65536 to set the limit higher, and then launch nginx manually from the shell and nginx is happy and doesn't complain about the 1024 limit.  However when my init.d script launches nginx it still gives that warning about the limit of 1024.

You have 2 solutions:
1) execute unlimit -n 65536 in the init.d script, before starting nginx
2) if you have PAM installed, check /etc/security/limits.conf
    (this is the location on Linux Debian):

    www-data  hard  nofile  65536

Manlio Perillo

More information about the nginx mailing list