简体   繁体   English

ubuntu21.10无法执行apache2重启命令

[英]Cannot execute apache2 restart command in ubuntu21.10

After I executed the command: sudo systemctl restart apache2 in the terminal, it prompted an error:我在终端执行命令: 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.

After executing the systemctl status apache2.service command according to the above prompt, I received this prompt:根据上面的提示执行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.

After executing the journalctl -xeu apache2.service command according to the above prompt, I received this prompt:按照上面的提示执行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.

Its possible that you may already have some other webserver running on your website which is using port 80, because you have error RTT apachectl[14923]: (98)Address already in use: AH00072: make>您可能已经在您的网站上运行了使用端口 80 的其他网络服务器,因为您有错误RTT apachectl[14923]: (98)Address already in use: AH00072: make>

Please try this:请试试这个:

Check first what is using port 80首先检查什么在使用端口 80

sudo netstat -nap | grep 80

Now use command to identify process (in my case "httpd")现在使用命令来识别进程(在我的例子中是“httpd”)

ps -ax | grep httpd

If you identify the process please kill them and try again to restart apache2.如果您识别出该进程,请杀死它们并再次尝试重新启动 apache2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM