Apache2 无法在 Ubuntu 20.04 中启动

Apache2 无法在 Ubuntu 20.04 中启动

我在使用 Ubuntu 20.04 时遇到了问题,我一直尝试在安装 WINE 后安装 PlayOnLinux。当通过命令安装 PlayOnLinux 时,我删除了一些我忘记的依赖项。

我还通过命令删除了 Apache whereis apache2,并找到了一些目录,并使用sudo rm -rf <all directory which found before command (whereis apache2)>

之后我尝试运行 apache2,但遇到了问题。我删除了 apache2 和 PHP,然后重新安装了 apache2,但出现了下面写的相同问题。

  • 第一个命令:
asifulmamun@asifulmamun-ubuntu:~$ 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.
  • 第二条命令:
asifulmamun@asifulmamun-ubuntu:~$ systemctl status apache2.service
● apache2.service - The Apache HTTP Server
        Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
        Active: failed (Result: exit-code) since Fri 2020-11-13 16:36:15 +06; 26s ago
        Docs: https://httpd.apache.org/docs/2.4/
        Process: 3522 ExecStart=/usr/sbin/apachectl start (code=exited, status=126)
Nov 13 16:36:15 asifulmamun-ubuntu systemd[1]: Starting The Apache HTTP Server...
Nov 13 16:36:15 asifulmamun-ubuntu apachectl[3535]: /usr/sbin/apachectl: 174: /usr/sbin/apache2: Permission >
Nov 13 16:36:15 asifulmamun-ubuntu apachectl[3522]: Action 'start' failed.
Nov 13 16:36:15 asifulmamun-ubuntu apachectl[3522]: The Apache error log may have more information.
Nov 13 16:36:15 asifulmamun-ubuntu systemd[1]: apache2.service: Control process exited, code=exited, status=>
Nov 13 16:36:15 asifulmamun-ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 13 16:36:15 asifulmamun-ubuntu systemd[1]: Failed to start The Apache HTTP Server.
  • 第三条命令:
asifulmamun@asifulmamun-ubuntu:~$ journalctl -xe
-- Support: http://www.ubuntu.com/support
-- 
-- The unit apache2.service has entered the 'failed' state with result 'exit-code'.
   Nov 13 17:46:37 asifulmamun-ubuntu systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: A start job for unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit apache2.service has finished with a failure.
-- 
-- The job identifier is 2312 and the job result is failed.
Nov 13 17:46:37 asifulmamun-ubuntu sudo[77289]: pam_unix(sudo:session): session closed for user root
Nov 13 17:46:41 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: WPA: Group rekeying completed with 7c:8b:ca:7>
Nov 13 17:46:44 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-REGDOM-CHANGE init=BEACON_HINT typ>
Nov 13 17:46:57 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:49:31 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:49:38 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:49:41 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:49:46 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:49:49 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:49:51 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS
Nov 13 17:50:10 asifulmamun-ubuntu wpa_supplicant[876]: wlp2s0: CTRL-EVENT-BEACON-LOSS

目前的解决方案是什么?

答案1

通常不建议手动卸载使用包管理器安装的软件(如 Apache)。最好的做法是卸载并清除 apache2,然后在需要时重新安装。确保在执行此操作之前备份所有配置文件。

sudo apt-get remove apache2
sudo apt-get purge apache2

然后可以再次安装。

相关内容