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

Created:

2016-11-16 13:18:21 UTC

Modified:

2017-04-24 11:13:03 UTC

1

Was this article helpful?


Have more questions?

Submit a request

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

Applicable to:

  • Plesk for Linux

Symptoms

It is not possible to start or restart Apache web server, all websites down:

# /etc/init.d/httpd start
Starting httpd: [FAILED]

The following error can be observed in the /var/log/httpd/error_log file:

Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down

[Wed Feb 12 03:01:46 2014] [error] (24)Too many open files: Init: Can't open server certificate file /usr/local/psa/var/certificates/cert8bV9dbI
'import site' failed; use -v for traceback

Cause

Maximum allowed number of the file descriptors is not enough for Apache web server.

Resolution

To fix the issue perform the following:

  1. If you have Ubuntu/Debian:

    Put the APACHE_ULIMIT_MAX_FILES='ulimit -n 131072' string in the /etc/apache2/envvars file:

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

    If you have CentOS:

    • Comment out the following section in the /usr/sbin/apachectl

      #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_MAX_FILES
      #fi
    • Set needed ULIMIT value in httpd configuration after commented section, add ulimit -n 131072 to the /usr/sbin/apachectl file:

      #    $ULIMIT_MAX_FILES
      #fi
      ulimit -n 131072
    • Add needed ULIMIT value in /etc/sysconfig/httpd configuration:

      # grep -i ulimit /etc/sysconfig/httpd
      ulimit -n 131072
  2. Restart the Apache service:

    # /etc/init.d/httpd restart
Have more questions? Submit a request
Please sign in to leave a comment.