无法重新启动 Apache Web 服务器 - Ubuntu

无法重新启动 Apache Web 服务器 - Ubuntu

我正在 ubuntu 上编辑 apache 模块,当我尝试使用重新启动服务器时,service apache2 restart我收到以下消息:

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 - 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 Mon 2017-09-04 10:53:07 PDT; 3min 21s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2594 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Sep 04 10:53:07 ubuntu apache2[2594]:  *
Sep 04 10:53:07 ubuntu apache2[2594]:  * The apache2 configtest failed.
Sep 04 10:53:07 ubuntu apache2[2594]: Output of config test was:
Sep 04 10:53:07 ubuntu apache2[2594]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 2 o
Sep 04 10:53:07 ubuntu apache2[2594]: Action 'configtest' failed.
Sep 04 10:53:07 ubuntu apache2[2594]: The Apache error log may have more information.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 04 10:53:07 ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Unit entered failed state.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.

journalctl -xe

Sep 04 10:53:07 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.
Sep 04 10:53:07 ubuntu apache2[2594]:  * Starting Apache httpd web server apache2
Sep 04 10:53:07 ubuntu apache2[2594]:  *
Sep 04 10:53:07 ubuntu apache2[2594]:  * The apache2 configtest failed.
Sep 04 10:53:07 ubuntu apache2[2594]: Output of config test was:
Sep 04 10:53:07 ubuntu apache2[2594]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 2 o
Sep 04 10:53:07 ubuntu apache2[2594]: Action 'configtest' failed.
Sep 04 10:53:07 ubuntu apache2[2594]: The Apache error log may have more information.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 04 10:53:07 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.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Unit entered failed state.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 04 10:53:07 ubuntu polkitd(authority=local)[1030]: Unregistered Authentication Agent for unix-process:2581:81632 (system b
Sep 04 10:54:56 ubuntu systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Sep 04 10:54:56 ubuntu systemd-tmpfiles[2610]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring.
Sep 04 10:54:56 ubuntu systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- 
-- The start-up result is done.
lines 2223-2262/2262 (END)

我的 apache2.conf 不是 140 行,因为它是基于我的所有模块的 conf 文件生成的。

请问我该如何进一步调查?

答案1

怎么修apache2.service 的作业失败,因为控制进程退出并显示错误代码

有很多事情可能会出错,从而导致您的 Apache Web 服务器无法正常启动或根本无法启动。这可能只是一个分号、一个多余的字符或一个无效的目录等。

要修复错误,您必须跟踪该**错误首先和简单纠正一下。*这比你想象的要简单,相信我。***

尝试这个:

打开终端并输入:

apache2ctl -t

上述命令将直接引导您找到所讨论的错误,您将知道如何修复它,如果没有,请在此处报告您的错误,我们都可以提供帮助。

我相信团队合作,希望这会有所帮助。

相关内容