Nginx on macOS : open files resource limit
Try this in your terminal:
ulimit -a
And the result should be sth similar to this:
core file size (blocks, -c) 0data seg size (kbytes, -d) unlimitedfile size (blocks, -f) unlimitedmax locked memory (kbytes, -l) unlimitedmax memory size (kbytes, -m) unlimitedopen files (-n) 256pipe size (512 bytes, -p) 1stack size (kbytes, -s) 8192cpu time (seconds, -t) unlimitedmax user processes (-u) 709virtual 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
Agree with lifecomm's solution, better targeting of specific nginx issue:
worker_rlimit_nofile changes the limit on the maximum number of open files (RLIMIT_NOFILE) for worker processes. Used to increase the limit without restarting the main process.