25 September, 2021

Plesk

liton

680 views


Could it be possible that the overall number of open files exceeds your allotment? Test it with
# lsof | wc -l

 

Create a /etc/nginx/ulimit.global_params file and enter
worker_rlimit_nofile 64000;
into it. If the worker_rlimit_nofile entry is present in /etc/nginx/nginx.conf omit this step.

Increase the general maximum file descriptor value:
# vi /etc/sysctl.conf
Add/modify:
fs.file-max = 64000

Edit /etc/security/limits.conf and add:
nginx soft nofile 64000
nginx hard nofile 64000

echo 'NGINX_ULIMIT="-n 64000"' >> /etc/sysconfig/nginx

Edit /usr/lib/systemd/system/nginx.service and add a line in the [Service] section:
LimitNOFILE=64000

In /etc/sysconfig/nginx.systemd add:
LimitNOFILE=64000

Add the line ulimit -n 64000 at the beginning of the /usr/local/psa/admin/sbin/nginx-config script:
#!/usr/bin/env bash
ulimit -n 64000

Reload system daemon:
# systemctl --system daemon-reload
# sysctl -p

Restart sw-cp-server and nginx:
# /etc/init.d/sw-cp-server restart
# /etc/init.d/nginx restart

 

 

grep 'Max open files' /proc/$(cat /var/run/nginx.pid)/limits
Max open files 4096 4096 file

 

source:
https://talk.plesk.com/threads/nginx-24-too-many-open-files.347297
https://support.plesk.com/hc/en-us/articles/213938485-nginx-fails-to-start-reload-on-a-Plesk-server-Too-many-open-files