当我尝试重新加载 Apache2 时,Apache2 无法正常工作,错误消息出现。我对服务器和 Apache2 还很陌生,您能帮我运行 apache2 吗?以下是错误代码。
:/etc/apache2/sites-available# sudo service apache2 reload
* Reloading web server apache2 *
* The apache2 configtest failed. Not doing anything.
Output of config test was:
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost define d at /etc/apache2/sites-enabled/test.conf:1
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost define d at /etc/apache2/sites-enabled/000-default.conf:1
AH00014: Configuration check failed
Action 'configtest' failed.
The Apache error log may have more information.
答案1
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/'
检查是否/var/log/apache2
目录存在并且 Apache 对其具有读写访问权限。
答案2
如果没有该文件夹,/var/log/apache2/
Apache 将无法在那里写入日志。
因此,请先创建它mkdir /var/log/apache2
,或者将 apache.conf 中的日志文件夹更改为其他内容。
确保权限也是正确的。chmod 750 /var/log/apache2