首页 > 解决方案 > Apache 未启动:(98)地址已在使用中

问题描述

昨天我的 WordPress 网站离线显示错误ERR_CONNECTION_REFUSED。今天我发现我的 VPS 中的 Apache 已关闭。启动 Apache,我的控制面板返回:

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
 httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-12-23 17:05:28 UTC; 7min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 7728 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 7727 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 7727 (code=exited, status=1/FAILURE)

Dec 23 17:05:27 site.com systemd[1]: Starting The Apache HTTP Server...
Dec 23 17:05:28 site.com httpd[7727]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443 (hidden ip)
Dec 23 17:05:28 site.com httpd[7727]: no listening sockets available, shutting down
Dec 23 17:05:28 site.com httpd[7727]: AH00015: Unable to open logs
Dec 23 17:05:28 site.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Dec 23 17:05:28 site.com kill[7728]: kill: cannot find process ""
Dec 23 17:05:28 site.com systemd[1]: httpd.service: control process exited, code=exited status=1
Dec 23 17:05:28 site.com systemd[1]: Failed to start The Apache HTTP Server.
Dec 23 17:05:28 site.com systemd[1]: Unit httpd.service entered failed state.
Dec 23 17:05:28 site.com systemd[1]: httpd.service failed.

我试图发现端口上正在运行哪些服务,以杀死它们,但端口 80 和 443 没有被使用。

通过专门查询这些端口,它们返回:

80/tcp closed http
443/tcp closed https

即使门关闭,尝试启动 apache 服务时也会发生错误。我搜索了 Stack Overflow 的答案,尝试了所有关于这些问题的答案方法,但都没有解决问题。

我正在使用Webmin7.7.1908CentOS更新

标签: apachecentoswebmin

解决方案


我有完全相同的问题,我打开了这个文件:

/etc/httpd/conf.d/ssl.conf

并看到了这两行:

Listen 443 https
Listen MY_IP:443

我刚刚评论了第一行,如下所示:

# Listen 443 https
Listen MY_IP:443

一切都正常了。我能够启动httpd服务。

systemctl start httpd.service


推荐阅读