无法安装 apache2

无法安装 apache2

我尝试在 Ubuntu 服务器上重新安装(通过aptapache2服务,但未成功。更具体地说,安装过程完成时没有任何错误,但

  1. 服务永远不开始
$ systemctl start apache2
$ systemctl status apache2
● 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: inactive (dead) since Mon 2020-11-30 17:15:08 CET; 11s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 18754 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 18747 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Nov 30 17:15:08 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 17:15:08 www systemd[1]: Started LSB: Apache2 web server.

  1. 我注意到缺少文件,例如/usr/sbin/apache2/usr/lib/apache2。事实上,
$ whereis apache2
apache2: /etc/apache2 /usr/share/apache2

我该如何正确安装该服务?

编辑:

● 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 Mo 2020-11-30 17:40:45 CET; 29s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 20855 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Nov 30 17:40:45 www apache2[20855]:  *
Nov 30 17:40:45 www apache2[20855]:  * The apache2 configtest failed.
Nov 30 17:40:45 www apache2[20855]: Output of config test was:
Nov 30 17:40:45 www apache2[20855]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 29 of /etc/apache2/sites-enabled/000-default.conf: Expected </XVirtualHost> but saw </VirtualHost>
Nov 30 17:40:45 www apache2[20855]: Action 'configtest' failed.
Nov 30 17:40:45 www apache2[20855]: The Apache error log may have more information.
Nov 30 17:40:45 www systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 30 17:40:45 www systemd[1]: Failed to start LSB: Apache2 web server.
Nov 30 17:40:45 www systemd[1]: apache2.service: Unit entered failed state.
Nov 30 17:40:45 www systemd[1]: apache2.service: Failed with result 'exit-code'.

还,

Nov 30 14:51:34 www systemd[1]: Started LSB: Apache2 web server.
Nov 30 16:25:00 www systemd[1]: Stopped LSB: Apache2 web server.
Nov 30 16:25:00 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 16:25:00 www systemd[1]: Started LSB: Apache2 web server.
Nov 30 16:25:53 www systemd[1]: Stopped LSB: Apache2 web server.
Nov 30 16:25:53 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 16:25:53 www systemd[1]: Started LSB: Apache2 web server.
Nov 30 16:32:42 www systemd[1]: Stopped LSB: Apache2 web server.
Nov 30 16:38:02 www systemd[1]: Stopped LSB: Apache2 web server.
Nov 30 16:39:21 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 16:39:21 www systemd[1]: Started LSB: Apache2 web server.
Nov 30 17:15:08 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 17:15:08 www systemd[1]: Started LSB: Apache2 web server.
Nov 30 17:39:32 www systemd[1]: Stopped LSB: Apache2 web server.
Nov 30 17:39:51 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 17:39:51 www apache2[20730]:  * Starting Apache httpd web server apache2
Nov 30 17:39:51 www apache2[20730]:  *
Nov 30 17:39:51 www apache2[20730]:  * The apache2 configtest failed.
Nov 30 17:39:51 www apache2[20730]: Output of config test was:
Nov 30 17:39:51 www apache2[20730]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 29 of /etc/apache2/sites-enabled/000-default.conf: Expected </XVirtualHost> but saw </Virt
Nov 30 17:39:51 www apache2[20730]: Action 'configtest' failed.
Nov 30 17:39:51 www apache2[20730]: The Apache error log may have more information.
Nov 30 17:39:51 www systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 30 17:39:51 www systemd[1]: Failed to start LSB: Apache2 web server.
Nov 30 17:39:51 www systemd[1]: apache2.service: Unit entered failed state.
Nov 30 17:39:51 www systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 30 17:40:16 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 17:40:16 www apache2[20830]:  * Starting Apache httpd web server apache2
Nov 30 17:40:16 www apache2[20830]:  *
Nov 30 17:40:16 www apache2[20830]:  * The apache2 configtest failed.
Nov 30 17:40:16 www apache2[20830]: Output of config test was:
Nov 30 17:40:16 www apache2[20830]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 29 of /etc/apache2/sites-enabled/000-default.conf: Expected </XVirtualHost> but saw </Virt
Nov 30 17:40:16 www apache2[20830]: Action 'configtest' failed.
Nov 30 17:40:16 www apache2[20830]: The Apache error log may have more information.
Nov 30 17:40:16 www systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 30 17:40:16 www systemd[1]: Failed to start LSB: Apache2 web server.
Nov 30 17:40:16 www systemd[1]: apache2.service: Unit entered failed state.
Nov 30 17:40:16 www systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 30 17:40:45 www systemd[1]: Starting LSB: Apache2 web server...
Nov 30 17:40:45 www apache2[20855]:  * Starting Apache httpd web server apache2
Nov 30 17:40:45 www apache2[20855]:  *
Nov 30 17:40:45 www apache2[20855]:  * The apache2 configtest failed.
Nov 30 17:40:45 www apache2[20855]: Output of config test was:
Nov 30 17:40:45 www apache2[20855]: apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 29 of /etc/apache2/sites-enabled/000-default.conf: Expected </XVirtualHost> but saw </Virt
Nov 30 17:40:45 www apache2[20855]: Action 'configtest' failed.
Nov 30 17:40:45 www apache2[20855]: The Apache error log may have more information.
Nov 30 17:40:45 www systemd[1]: apache2.service: Control process exited, code=exited status=1
Nov 30 17:40:45 www systemd[1]: Failed to start LSB: Apache2 web server.
Nov 30 17:40:45 www systemd[1]: apache2.service: Unit entered failed state.
Nov 30 17:40:45 www systemd[1]: apache2.service: Failed with result 'exit-code'.

相关内容