Unable to start Apache service: No such file or directory: httpd: could not open error log file

Created:

2016-11-16 13:23:09 UTC

Modified:

2017-08-16 16:51:10 UTC

1

Was this article helpful?


Have more questions?

Submit a request

Unable to start Apache service: No such file or directory: httpd: could not open error log file

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 10.x for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux

Symptoms

Unable to start or restart httpd web server:

Service httpd failed to start

Generating the web server configuration fails with the following error:

Unable to generate the web server configuration file on the host example.com because of the following errors:

Template_Exception: Can not restart web server: Service /etc/init.d/httpd failed to start Service /etc/init.d/httpd failed to start
file: /usr/local/psa/admin/plib/Service/Driver/Web/Server/Apache.php
line: 100
code: 0
Please resolve the errors in web server configuration templates and generate the file again.

Apache error log /var/log/httpd/error_log contains:

(2)No such file or directory: httpd: could not open error log file         /var/log/apache2/example.com_error.log

or:

(2)No such file or directory: httpd: could not open error log file /var/www/vhosts/system/example.com/logs/error_log.
Unable to open logs

Directory /var/www/vhosts/system/example.com/logs does not present on a server:

# ll /var/www/vhosts/system/example.com/logs/
ls: /var/www/vhosts/system/example.com/logs/: no such file or directory

Cause

The Apache configuration contains a reference to a non-existent file or directory.

Resolution

Create the required file (directory) and start the httpd service:

# mkdir /var/www/vhosts/system/example.com/logs/
# touch /var/www/vhosts/system/example.com/logs/error_log
# touch /var/www/vhosts/system/example.com/logs/access_log
# chmod 700 /var/www/vhosts/system/example.com/logs/
# chown psaadm:root /var/www/vhosts/system/example.com/logs/
# service httpd restart

When the web service is started, try to find out which configuration file contains a link to the mentioned log file. You can do this by going through the configuration inside the /etc/httpd/conf.d/ directory. Each config may contain the Include directive, which in turn includes the next file.

Plesk manages configuration files that are listed in /etc/httpd/conf.d/zz010_psa_httpd.conf . If the file mentioned in the error is not present in the files included there, it was probably configured manually.

Have more questions? Submit a request
Please sign in to leave a comment.