The issue can come from different sources on your server. For Debian, for example, consider increasing the following values to avoid hitting open file limits (web server / mail / PHP):
/etc/security/limits.conf
Code:
* hard nofile 1048576
* soft nofile 1048576
root hard nofile 1048576
root soft nofile 1048576
/etc/sysctl.d/10-own-settings.conf
Code:
# Kernel 5.11 will raise those limits automatically based on host memory, but 5.10 is still using default low values: 8192 / 128
fs.inotify.max_user_watches = 560144
fs.inotify.max_user_instances = 1024
/etc/systemd/system.conf
Code:
DefaultLimitNOFILE=1048576:1048576
DefaultLimitNPROC=1048576:1048576
/etc/systemd/user.conf
Code:
DefaultLimitNOFILE=1048576:1048576
DefaultLimitNPROC=1048576:1048576
/opt/plesk/php/*/etc/php-fpm.conf
/etc/nginx/nginx.conf
Code:
# CPU core count * 1024
worker_connections 32768;
/etc/nginx/ulimit.global_params
Code:
worker_rlimit_nofile 524288;
/etc/dovecot/conf.d/10-master.conf
Code:
default_client_limit = 4299
/etc/systemd/system/nginx.service.d/override.conf
Code:
[Service]
LimitNOFILE=1048576
/etc/systemd/system/sw-cp-server.service.d/override.conf
Code:
[Service]
LimitNOFILE=524288
/etc/systemd/system/mariadb.service.d/override.conf
Code:
[Service]
LimitNOFILE=524288
/etc/apache2/envvars
Code:
APACHE_ULIMIT_MAX_FILES='ulimit -n 524288'
For other OSes, look for the corresponding settings. It also makes sense to monitor the configuration for changes, for example via Ansible, to make it more resilient.