Nginx worker_connections exceed open file resource

Nginx worker_connections exceed open file resource
nginx

When you restart the nginx service and you see this meassage then you have a problem with the file limits.

root@web01:/var/log/nginx# service nginx restart

* Restarting nginx nginx nginx: [warn] 4096 worker_connections exceed open file resource limit: 1024
 nginx: [warn] 4096 worker_connections exceed open file resource limit: 1024

You can set in manual

ulimit -n 65536

When you like to see the open files limit you can see it with

root@web01:/var/log/nginx# ulimit -n
65536

You can also see all limits with

root@web01:/var/log/nginx# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 256697
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 256697
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

On Ubuntu and Debian you can set the limits in /etc/security/limits.conf with

* soft nofile 65536
* hard nofile 65536

Leave a Reply

Your email address will not be published. Required fields are marked *