Question: Unable to start Apache/nginx on a Plesk server: AH02291: Cannot access directory for error log of vhost
Applicable to:Symptoms- All websites hosted in Plesk are not accessible.
- The following error message is shown on the Home page in Plesk:
New configuration files for the Apache web server were not created due to the errors in configuration templates: (2)No such file or directory: AH02291: Cannot access directory '/var/www/vhosts/system/example.com/logs/' for error log of vhost defined at /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf:104
- Apache/nginx web-servers cannot be started. The following error messages appear in the system logfile (/var/log/messages on CentOS/RHEL, /var/log/syslog on Debian/Ubuntu):
httpd: (2)No such file or directory: AH02291: Cannot access directory '/var/www/vhosts/system/example.com/logs/' for error log of vhost defined at /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf:10
nginx: [emerg] open() "/var/www/vhosts/system/example.com/logs/proxy_access_ssl_log" failed (2: No such file or directoryCauseThe domain's logs directory does not exist on the server.
Resolution1.Connect to the Plesk server via SSH.
2.Create the missing directories with the command:
# plesk repair fs example.com -y
3.Re-link the logfiles:
3.1. Remove the logs directory inside domain's directory:
# rm -rf /var/www/vhosts/example.com/logs
3.2. Find the system user of a subscription using the command below:
# plesk db "select name, login from domains join hosting on domains.id=hosting.dom_id join sys_users on hosting.sys_user_id=sys_users.id where name='example.com'";
+-------------+-------+
| name | login |
+-------------+-------+
| example.com | jdoe |
+-------------+-------+
3.3. Re-link the logfiles:
# plesk sbin relink-vhost-logs --domain-name example.com --sys-user-login jdoe --create
4.Start the Apache web-server:
- on CentOS/RHEL-based distributions:
# service httpd start
- on Debian/Ubuntu-based distributions:
# service apache2 start
5.Start the nginx web-server:
# service nginx start