【问题标题】:Cannot execute apache2 restart command in ubuntu21.10在 ubuntu21.10 中无法执行 apache2 restart 命令
【发布时间】:2022-01-21 19:18:29
【问题描述】:

我在终端执行命令:sudo systemctl restart apache2后,提示错误:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.

根据上面的提示执行systemctl status apache2.service命令后,收到这个提示:

 × apache2.service - The Apache HTTP Server
         Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor prese>
         Active: failed (Result: exit-code) since Mon 2021-12-20 09:50:13 +06; 9min>
           Docs: https://httpd.apache.org/docs/2.4/
        Process: 14920 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/F>
            CPU: 18ms
Жел 20 09:50:13 RTT apachectl[14923]: [Mon Dec 20 09:50:13.739503 2021] [alias:>
Жел 20 09:50:13 RTT apachectl[14923]: AH00558: apache2: Could not reliably dete>
Жел 20 09:50:13 RTT apachectl[14923]: (98)Address already in use: AH00072: make>
Жел 20 09:50:13 RTT apachectl[14923]: (98)Address already in use: AH00072: make>
Жел 20 09:50:13 RTT apachectl[14923]: no listening sockets available, shutting >
Жел 20 09:50:13 RTT apachectl[14923]: AH00015: Unable to open logs
Жел 20 09:50:13 RTT systemd[1]: apache2.service: Failed with result 'exit-code'.
Жел 20 09:50:13 RTT apachectl[14920]: Action 'start' failed.
Жел 20 09:50:13 RTT apachectl[14920]: The Apache error log may have more inform>
Жел 20 09:50:13 RTT systemd[1]: Failed to start The Apache HTTP Server.

按照上面提示执行journalctl -xeu apache2.service命令后,收到这个提示:

The process' exit code is 'exited' and its exit status is 1.
Жел 20 09:50:13 RTT apachectl[14923]: [Mon Dec 20 09:50:13.739503 2021] [alias:>
Жел 20 09:50:13 RTT apachectl[14923]: AH00558: apache2: Could not reliably dete>
Жел 20 09:50:13 RTT apachectl[14923]: (98)Address already in use: AH00072: make>
Жел 20 09:50:13 RTT apachectl[14923]: (98)Address already in use: AH00072: make>
Жел 20 09:50:13 RTT apachectl[14923]: no listening sockets available, shutting >
Жел 20 09:50:13 RTT apachectl[14923]: AH00015: Unable to open logs
Жел 20 09:50:13 RTT systemd[1]: apache2.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit apache2.service has entered the 'failed' state with result 'exit-co>
Жел 20 09:50:13 RTT apachectl[14920]: Action 'start' failed.
Жел 20 09:50:13 RTT apachectl[14920]: The Apache error log may have more inform>
Жел 20 09:50:13 RTT 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 3993 and the job result is failed.

【问题讨论】:

  • 您能否edit/var/log/apache2/error.log 的最后几行包含在内?这将包含有关 Apache 为何无法运行的更具体信息。

标签: mysql ubuntu phpmyadmin localhost apache2


【解决方案1】:

您的网站上可能已经运行了其他使用端口 80 的网络服务器,因为您遇到错误 RTT apachectl[14923]: (98)Address already in use: AH00072: make>

请试试这个:

首先检查什么正在使用端口 80

sudo netstat -nap | grep 80

现在使用命令来识别进程(在我的例子中是“httpd”)

ps -ax | grep httpd

如果您识别出该进程,请杀死它们并再次尝试重新启动 apache2。

【讨论】:

  • 没有这个命令:sudo: netstat: command not found
  • 请用命令安装 --> sudo apt-get install net-tools
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-06-22
  • 2014-01-14
  • 2014-11-20
  • 2013-11-08
  • 2020-11-02
  • 1970-01-01
  • 2020-06-19
相关资源
最近更新 更多