Nginx on macOS : open files resource limit

Add to nginx.conf in main section:

worker_rlimit_nofile 1024;

Try this in your terminal:

ulimit -a

And the result should be sth similar to this:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

In your case, to increase the open files limit to 1024, use this code:

ulimit -n 1024

Check by running sudo nginx -t and let's hope you don't see the error again

Tags:

Nginx

Macos