Search for:

Available article translations:

If there are more than 256 domains, Nginx fails with "Too many open files" error

  • Parallels Plesk Panel 11.5 for Linux


When Nginx support is enabled and there are a lot of domains (more than 256), Nginx will fail with the following error:

2012-11-08T20:13:34+07:00 ERR (3): Apache config (13523804010.47553900) generation failed: nginx: [emerg] open() "/var/www/vhosts/test255.tld/statistics/logs/proxy_access_ssl_log" failed (24: Too many open files)
nginx: configuration file /etc/nginx/nginx.conf test failed


The Nginx virtual host opens four log files for each virtual host with physical hosting:

  1. proxy_access_log
  2. proxy_access_ssl_log
  3. webmail_access_log
  4. webmail_access_ssl_log

Due to this, the maximum amount of open files is exceeded by the Nginx server.


  1. Set needed ULIMIT value in Nginx configuration:


    # echo 'ULIMIT="-n 4096"' >> /etc/default/nginx


    # echo 'ULIMIT="-n 4096"' >> /etc/sysconfig/nginx
  2. Set the max opened files limit in the 'sysctl.conf':

    grep fs.file-max /etc/sysctl.conf
    fs.file-max = 4096
  3. Set the 'worker_rlimit_nofile' in Nginx configuration t oincrease the maximum of opened files amount by the worked process:

    grep 16384 /etc/nginx/nginx.conf worker_rlimit_nofile 16384;

Further steps are required only for Parallels Plesk Panel 11.0.9.

  1. Download and apply the needed patch by running the commands below. The first command creates a backup of the original file being patched and puts it into the /root directory:

    # cp /etc/init.d/nginx /root/nginx.backup


    # wget
    # patch /etc/init.d/nginx nginx.debian-ubuntu.patch


    # wget
    # patch /etc/init.d/nginx nginx.redhat-centos.patch


    # wget
    # patch /etc/init.d/nginx nginx.suse.patch
  2. Change the limit for open file descriptors for the root and psaadm users:

    # egrep "root|psaadm" /etc/security/limits.conf
    root hard nofile 4096
    root soft nofile 4096
    psaadm hard nofile 4096
    psaadm soft nofile 4096

Note: Terminal re-login is needed for the changes to take effect.

  1. Add line ulimit -n 32768 at the beginning of script /usr/local/psa/admin/sbin/nginx-config:

    #!/usr/bin/env bash
    ulimit -n 32768
  2. Restart sw-cp-server and Nginx services:

    # /etc/init.d/sw-cp-server restart
    # /etc/init.d/nginx restart
  3. regenerate web-server configuration:

    # /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

Additional information

Since the hotfix is not included to any microupdate of Parallels Plesk Panel 11.x yet, file /etc/init.d/nginx will be overwritten during installation of a microupdate in future.

Search words:

Unable to load object of type BsDomain with id=7: Domaine inexistant.


c7658ac2f68d6572a213687c1077afff 56797cefb1efc9130f7c48a7d1db0f0c 49af2da0f2dd4c81e962790bbbd0c2b4 5d735c0e028ee5b991e4fb80d34fb87f 6d7d554563b7b77c7f8e8a903a4c0630

Was this article helpful?
Tell us how we may improve it.
Yes No
Desktop Virtualization
- Parallels Desktop 9 for Mac
- Parallels Transporter
- Parallels Desktop Switch to Mac Edition
- Parallels Desktop for Mac Enterprise Edition
- Parallels Management-Mac for Microsoft SCCM
Server Virtualization
- Parallels Cloud Server
- Parallels Containers for Windows 6.0 Beta
- Parallels Virtuozzo Containers
- Parallels Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Web Presence Builder
- Parallels Plesk Automation
- Parallels Small Business Panel
- Value-added Services for Hosters
- Parallels Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification