无法启动 LSB:Apache2 Web 服务器,apache2 崩溃

无法启动 LSB:Apache2 Web 服务器,apache2 崩溃

我使用 Ubuntu 16.04,遇到了 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.

下面是这两个状态命令的打印输出:

$sudo systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Fri 2018-08-24 19:15:41 CEST; 2min 35s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8631 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
   CGroup: /system.slice/apache2.service
           └─8645 [pdflush-0

Aug 24 19:15:21 tegra-ubuntu systemd[1]: Starting LSB: Apache2 web server...
Aug 24 19:15:21 tegra-ubuntu apache2[8631]:  * Starting Apache httpd web server apache2
Aug 24 19:15:41 tegra-ubuntu apache2[8631]:  *
Aug 24 19:15:41 tegra-ubuntu apache2[8631]:  * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Aug 24 19:15:41 tegra-ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 24 19:15:41 tegra-ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
Aug 24 19:15:41 tegra-ubuntu systemd[1]: apache2.service: Unit entered failed state.
Aug 24 19:15:41 tegra-ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.

sudo journalctl -xe
Aug 24 19:20:03 tegra-ubuntu systemd[1]: Starting LSB: Apache2 web server...
-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has begun starting up.
Aug 24 19:20:03 tegra-ubuntu apache2[8768]:  * Starting Apache httpd web server apache2
Aug 24 19:20:23 tegra-ubuntu apache2[8768]:  *
Aug 24 19:20:23 tegra-ubuntu apache2[8768]:  * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Aug 24 19:20:23 tegra-ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 24 19:20:23 tegra-ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Aug 24 19:20:23 tegra-ubuntu systemd[1]: apache2.service: Unit entered failed state.
Aug 24 19:20:23 tegra-ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
Aug 24 19:20:23 tegra-ubuntu sudo[8736]: pam_unix(sudo:session): session closed for user root

并且 apache 的配置测试看起来很干净(如果不算服务器名警告)

apachectl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

更有趣的是,apache2 error.log 是空的

以下是 journalctl 的输出(我将其缩小了一点,因为它在 Apache2 上重复了相同的内容,因为我尝试让它运行)。看起来这也没有说明什么,很奇怪。

-- Logs begin at Wed 2018-08-22 21:52:44 CEST, end at Sat 2018-08-25 13:25:11 CEST. --
Aug 24 19:20:03 tegra-ubuntu systemd[1]: Starting LSB: Apache2 web server...
Aug 24 19:20:03 tegra-ubuntu apache2[8768]:  * Starting Apache httpd web server apache2
Aug 24 19:20:23 tegra-ubuntu apache2[8768]:  *
Aug 24 19:20:23 tegra-ubuntu apache2[8768]:  * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Aug 24 19:20:23 tegra-ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 24 19:20:23 tegra-ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
Aug 24 19:20:23 tegra-ubuntu systemd[1]: apache2.service: Unit entered failed state.
Aug 24 19:20:23 tegra-ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.

答案1

现在它变得越来越有趣了。

如果我将 apache2 设置为在没有文档根目录的情况下启动,请使用命令检查

apache2ctl -T

然后使用以下命令启动 apache,它启动时不会出现错误。

systemctl start apache2.service

但重启机器后,apache2 并没有像应该的那样自动启动,错误再次出现。知道现在发生了什么吗?

相关内容