启动 apache2 时出错“无法访问目录‘/var/log/apache2/’以获取主错误日志”

启动 apache2 时出错“无法访问目录‘/var/log/apache2/’以获取主错误日志”

当我运行时sudo service apache2 start出现此错误:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

当我跑步时systemctl status apache2.service我得到了这个:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-01-15 16:20:26 -03; 7min ago
  Process: 8101 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

ene 15 16:20:26 pc systemd[1]: Starting The Apache HTTP Server...
ene 15 16:20:26 pc apachectl[8101]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. 
ene 15 16:20:26 pc apachectl[8101]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
ene 15 16:20:26 pc apachectl[8101]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost 
ene 15 16:20:26 pc apachectl[8101]: AH00014: Configuration check failed
ene 15 16:20:26 pc apachectl[8101]: Action 'start' failed.
ene 15 16:20:26 pc apachectl[8101]: The Apache error log may have more information.
ene 15 16:20:26 pc systemd[1]: apache2.service: Control process exited, code=exited status=1
ene 15 16:20:26 pc systemd[1]: apache2.service: Failed with result 'exit-code'.
ene 15 16:20:26 pc systemd[1]: Failed to start The Apache HTTP Server.

我能做什么呢?

答案1

固定的

我刚刚创建了目录并授予它写权限:

sudo mkdir -p /var/log/apache2/
sudo chmod -R 744 /var/log/apache2/

相关内容