Plesk

Apache failed to start: (24)Too many open files: Init: Can’t open server certificate file

Symptoms

Cause

The maximum allowed number of file descriptors is not enough for Apache web server.

Resolution

Click on a section to expand

For Systemd OS (RHEL 7-based, Debian 8, Ubuntu 16.04)

  1. Connect to the server via SSH

  2. Set desired open files limit to for both Apache and Nginx, using the following shell utility

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

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

Another solution is to increase open file limit manually:

  1. Create the directory /lib/systemd/system/httpd.service.d/ directory (
    apache2.service.d
    in Debian and Ubuntu):

    # mkdir /lib/systemd/system/httpd.service.d/

  2. In this directory, create
    limit_nofile.conf
    file in it with the following content:

    # cat /lib/systemd/system/httpd.service.d/limit_nofile.conf
    [Service]
    LimitNOFILE=65536

  3. Reload systemd unit files and start Apache (in Debian and Ubuntu, service is called
    apache2.service
    ):

    # systemctl daemon-reload
    # systemctl start httpd.service

    Note: If the issue still persists on the Debian-like systems, increase limits through APACHE_ULIMIT_MAX_FILES environment variable as it is described below for SysVinit OSes.

For SysVinit OS (RHEL 6-based, RHEL 5, Debian 7)

  • For Debian and Ubuntu:

    1. Connect to the server via SSH

    2. Put the
      APACHE_ULIMIT_MAX_FILES='ulimit -n 131072'
      line into the
      /etc/apache2/envvars
      file:

      # grep ULIMIT /etc/apache2/envvars
      APACHE_ULIMIT_MAX_FILES='ulimit -n 131072'

    3. Restart the Apache service:

      # service apache2 restart

  • For RHEL-based operating systems:

    1. Connect to the server via SSH

    2. Comment the following section in the
      /usr/sbin/apachectl
      file:

      #ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
      #-------------------- --------------------
      #|||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
      #Set the maximum number of file descriptors allowed per child process.
      #if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
      #$ULIMIT…