nginx fails to start/reload on a Plesk server: Too many open files

Started by Suhitha, Nov 26, 2025, 03:50 AM

Previous topic - Next topic

Suhitha

Question: nginx fails to start/reload on a Plesk server: Too many open files

Applicable to:

  • Plesk for Linux

Symptoms

  • The nginx service fails to start/reload with the following error in the /var/log/nginx/error.log file:

nginx: [emerg] open() "/var/www/vhosts/system/example.com/logs/proxy_access_ssl_log" failed (24: Too many open files)
  • Some or all websites are not accessible
  • Warning is shown in the Tools & Settings > Diagnose & repair:

Checking for nginx ULIMIT value N domains have been found on server. Problem with nginx default limit for open files is possible

  • NodeJS and Ruby web applications are showing 502 Bad Gateway error when performing some Plesk tasks such as creating domains, subscriptions, changes on Apache or Nginx, etc:
Server Error
502 Bad Gateway
Web server received an invalid response while acting as a gateway or proxy server.

  • After installing a new certificate for the domain, the old one is still shown in a web browser, however, the correct certificate is selected at the Domains > example.com > Hosting Settings page.

Cause

If more than 33 domains live on the server the ulimit should get increased automatically. There is a bug ID PPPM-14951 when the ulimit is automatically increased due to the number of domains: the nginx and Apache service are not restarted, and as a result, the new ulimit does not take effect for the running NGINX process.


Resolution

Warning: Execution of the websrv_ulimits utility without --no-restart option initiates rebuilding of web configuration files for all domains and can cause significant downtime in case of a big number of hosted websites.

Execute the command during the maintenance time frame.

It is good practice to set open files limit value more than number of domains in Plesk * 16 at least. In example below provided actions how to set limit to 4096:

1.Connect to the server via SSH

2.Set open files limit to 4096 for both Apache and Nginx:

# /usr/local/psa/admin/sbin/websrv_ulimits --set 4096 --no-restart

3.Restart Apache and nginx services at Plesk > Tools & Settings > Services Management to apply changes.

4.Check that 'Max open files limit' was applied properly, after web services restarting:

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

5.If the solution above did not help, set the limit using the ulimit utility:

# ulimit -n 4096