Systemd
無法啟動 Apache HTTP 伺服器 - 單元 apache2.service 失敗
我最近通過安裝了 Apache2,
sudo apt install apache2
但它似乎無法正常工作。當我嘗試使用sudo /etc/init.d/apache2 restart
. 我正在使用 Kubuntu 18.04.1 64 位。-- Subject: Unit apache2.service has begun start-up -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- Unit apache2.service has begun starting up. Aug 29 13:31:47 alpaca-desktop apachectl[10871]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' di Aug 29 13:31:47 alpaca-desktop apachectl[10871]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log Aug 29 13:31:47 alpaca-desktop apachectl[10871]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /etc/apache2 Aug 29 13:31:47 alpaca-desktop apachectl[10871]: AH00014: Configuration check failed Aug 29 13:31:47 alpaca-desktop apachectl[10871]: Action 'start' failed. Aug 29 13:31:47 alpaca-desktop apachectl[10871]: The Apache error log may have more information. Aug 29 13:31:47 alpaca-desktop systemd[1]: apache2.service: Control process exited, code=exited status=1 Aug 29 13:31:47 alpaca-desktop systemd[1]: apache2.service: Failed with result 'exit-code'. Aug 29 13:31:47 alpaca-desktop systemd[1]: Failed to start The Apache HTTP Server. -- Subject: Unit apache2.service has failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- Unit apache2.service has failed. -- -- The result is RESULT.
這是原因:
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
如果該目錄不存在,那麼 Apache 如何啟動?如果是這樣,則為 Apache 指定的使用者無法訪問它,這意味著文件權限不正確。