- Plesk for Linux
When nginx support is enabled and there are a lot of domains (more than 256), nginx will fail with the following error:
CONFIG_TEXT: Apache config (13523804010.47553900) generation failed: nginx: [emerg] open() "/var/www/vhosts/system/example.com/logs/proxy_access_ssl_log" failed (24: Too many open files)
nginx: configuration file /etc/nginx/nginx.conf test failed
Incorrect SSL certificate is assigned to the domain.
- SSL certificate is not updated: after SSL certificate is changed in Plesk old certificate is shown in a web-browser.
- Domain shows only text without CSS.
Nginx's virtual host opens 4 log files for each virtual host with physical hosting:
As a result of this fact, the maximum number of open files is exceeded by nginx server.
Warning: Execution of
websrv_ulimits utility without --no-restart option initiates rebuilding of web configuration files for all domains and can cause a significant downtime in case of big number of hosted websites (>500). Execute the command during maintenance time frame.
Since Plesk 12.5, it is not required to tune this limit. It is getting increased automatically. However, if it is required to change it, use the following shell utility:
# /usr/local/psa/admin/sbin/websrv_ulimits --help
Usage: websrv_ulimits [--nginx|--apache] --set ULIMIT [--no-restart]
Example of usage:
# /usr/local/psa/admin/sbin/websrv_ulimits --set 4096 --no-restart
Restart web services to apply changes:
Apache web server on Debian/Ubuntu
# service apache2 restart
Apache web server on CentOS/RHEL
# service httpd restart
nginx web server
# service nginx restart
It will set an open files limit to 4096 for both Apache and Nginx (if present). If the issue still persists after execution of the command, consider to increase the value and make it twice bigger. It has a good practice to have this value set > number of domains in Plesk * 16 at least
For Plesk 12.0 and lower:
- Connect to the server using SSH
Set the required
ULIMITvalue in the nginx configuration:
# echo 'NGINX_ULIMIT="-n 4096"' >> /etc/default/nginx
# echo 'NGINX_ULIMIT="-n 4096"' >> /etc/sysconfig/nginx
worker_rlimit_nofilevalue in the nginx configuration to increase the maximum number of opened files allowed by the worker process:
# grep "worker_rlimit_nofile" /etc/nginx/nginx.conf
- This step should be done for systems using systemd only (instead of SysV and LSB):
LimitNOFILEshould be increased in
[Service]section. To do so, modify
systemddaemon should be reloaded after any changes in the unit configuration files:
# systemctl --system daemon-reload
# service nginx restart
Regenerate the web server configuration:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
Note: If execution of
nginx -t command still produces
Too many open files error, check limits for
root user in
/etc/security/limits.conf configuration file and increase them as well.