无法在 ubuntu 18.04 上启动 Apache HTTP 服务器

moe*_*oe_ 5 apache ubuntu apache2

我试图在我的 ubuntu 18.04 上创建一个 Web 服务器,所以我安装了 Apache2,但我无法启动它。这是我运行systemctl status apache2.service命令时出现的内容

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           ??apache2-systemd.conf
   Active: failed (Result: exit-code) since Sat 2020-02-22 13:58:09 CET; 34s ago
  Process: 2791 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Run Code Online (Sandbox Code Playgroud)
Feb 22 13:58:09 moemen apachectl[2791]: AH00558: apache2: Could not reliably determine the server's
Feb 22 13:58:09 moemen apachectl[2791]: (98)Address already in use: AH00072: make_sock: could not b
Feb 22 13:58:09 moemen apachectl[2791]: (98)Address already in use: AH00072: make_sock: could not b
Feb 22 13:58:09 moemen apachectl[2791]: no listening sockets available, shutting down
Feb 22 13:58:09 moemen apachectl[2791]: AH00015: Unable to open logs
Feb 22 13:58:09 moemen apachectl[2791]: Action 'start' failed.
Feb 22 13:58:09 moemen apachectl[2791]: The Apache error log may have more information.
Feb 22 13:58:09 moemen systemd[1]: apache2.service: Control process exited, code=exited status=1
Feb 22 13:58:09 moemen systemd[1]: apache2.service: Failed with result 'exit-code'.
Feb 22 13:58:09 moemen systemd[1]: Failed to start The Apache HTTP Server.
Run Code Online (Sandbox Code Playgroud)

我是新手,你能帮帮我吗

小智 8

我也面临同样的问题。

首先检查

$ sudo systemctl status nginx
Run Code Online (Sandbox Code Playgroud)

如果nginx处于活动状态,则停止此操作

$ sudo systemctl stop nginx
Run Code Online (Sandbox Code Playgroud)

然后再次尝试在不同的终端启动 apache2 服务器。


小智 8

首先删除apache2

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

之后,如果有文件(.conf)/etc/sites-available使用删除它们

rm example.com.conf
Run Code Online (Sandbox Code Playgroud)

然后再次安装 sudo apt-get install apache2

现在它会修复现在检查它 sudo ufw allow 'Apache' sudo systemctl status apache2