Though I have done the following setting, and even restarted the server:
# head /etc/security/limits.conf -n2
www-data soft nofile -1
www-data hard nofile -1
# /
For nginx simply editing nginx.conf
and setting worker_rlimit_nofile
should change the limitation.
I initially thought it is a self-imposed limit of nginx, but it increases limit per process:
worker_rlimit_nofile 4096;
You can test by getting a nginx process ID (from top -u nginx
), then run:
cat /proc/{PID}/limits
To see the current limits
Another way on CentOS 7 is by systemctl edit SERVICE_NAME
, add the variables there:
[Service]
LimitNOFILE=65536
save that file and reload the service.