重新启动 Apache2 服务时出现问题

重新启动 Apache2 服务时出现问题

我正在尝试重新启动 apache2 服务但遇到了错误。

重新加载:

Job for apache2.service invalid.

重新开始

Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.

journalctl-xe

Aug 18 02:17:49 xpto apache2[6754]: * Starting web server apache2
Aug 18 02:17:49 xpto apache2[6754]: *
Aug 18 02:17:49 xpto apache2[6754]: * The apache2 configtest failed.
Aug 18 02:17:49 xpto apache2[6754]: Output of config test was:
Aug 18 02:17:49 xpto apache2[6754]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Synt
Aug 18 02:17:49 xpto apache2[6754]: Action 'configtest' failed.
Aug 18 02:17:49 xpto apache2[6754]: The Apache error log may have more information.
Aug 18 02:17:49 xpto systemd[1]: apache2.service: control process exited, code=exited status=1
Aug 18 02:17:49 xpto 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

systemctl 状态 apache2.service

Aug 18 02:20:29 xpto apache2[6797]: *
Aug 18 02:20:29 xpto apache2[6797]: * The apache2 configtest failed.
Aug 18 02:20:29 xpto apache2[6797]: Output of config test was:
Aug 18 02:20:29 xpto apache2[6797]: apache2: Syntax error on line 219 of /etc/apache2/apache2.con... '>'
Aug 18 02:20:29 xpto apache2[6797]: Action 'configtest' failed.
Aug 18 02:20:29 xpto apache2[6797]: The Apache error log may have more information.
Aug 18 02:20:29 xpto systemd[1]: apache2.service: control process exited, code=exited status=1
Aug 18 02:20:29 xpto systemd[1]: Failed to start LSB: Apache2 web server.
Aug 18 02:20:29 xpto systemd[1]: Unit apache2.service entered failed state.
Aug 18 02:20:29 xpto systemd[1]: apache2.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

那么我做错了什么?我该怎么办? 第 219 行是:

IncludeOptional sites-enabled/*.conf

此致

答案1

对 Apache 配置文件进行任何更改后,在重新加载服务之前,请确保配置正确,否则会导致不必要的停机。

要验证 Apache 的配置语法:apachectl -t

其次,您可以寻找/var/log/httpd/error.log任何提示。

根据以上信息,这与配置文件中的语法错误有关。转到第 219 行并修复该行。

相关内容