title: Nginx worker_rlimit_nofile
body: <p>How does one set <code>worker_rlimit_nofile</code> to a higher number and what's the maxium it can be or is recommended to be?</p>
  
  <p>I'm trying to follow the following advice:</p>
  
  <blockquote>
    <p>The second biggest limitation that most people run into is also
    related to your OS. Open up a shell, su to the user nginx runs as and
    then run the command <code>ulimit -a</code>. Those values are all limitations
    nginx cannot exceed. In many default systems the open files value is
    rather limited, on a system I just checked it was set to 1024. If
    nginx runs into a situation where it hits this limit it will log the
    error (24: Too many open files) and return an error to the client.
    Naturally nginx can handle a lot more than 1024 files and chances are
    your OS can as well. You can safely increase this value.</p>
    
    <p>To do this you can either set the limit with ulimit or you can use
    worker_rlimit_nofile to define your desired open file descriptor
    limit.</p>
  </blockquote>
  
  <p>From: <a href="https://blog.martinfjordvald.com/2011/04/optimizing-nginx-for-high-traffic-loads/" rel="noreferrer">https://blog.martinfjordvald.com/2011/04/optimizing-nginx-for-high-traffic-loads/</a></p>