httpd 未启动,因为它无法绑定到端口 80。端口 80 上没有任何运行

httpd 未启动,因为它无法绑定到端口 80。端口 80 上没有任何运行

安装新证书并尝试重新启动 httpd 服务后,我不断收到以下消息:

$ httpd -X
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

我检查语法:

$ httpd -t
Syntax OK

服务检查让我得到这个:

$ systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2023-04-21 18:36:25 UTC; 14s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 254501 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 254501 (code=exited, status=1/FAILURE)

对于期刊 xe 我得到这个:

 sudo journalctl --no-pager -u httpd
-- Logs begin at Fri 2023-04-21 13:58:29 UTC, end at Fri 2023-04-21 19:12:22 UTC. --
Apr 21 13:58:47 domian.com systemd[1]: Starting The Apache HTTP Server...
Apr 21 13:58:49 domian.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 21 13:58:49 domian.com systemd[1]: Failed to start The Apache HTTP Server.
Apr 21 13:58:49 domian.com systemd[1]: Unit httpd.service entered failed state.
Apr 21 13:58:49 domian.com systemd[1]: httpd.service failed.
Apr 21 15:12:48 domian.com systemd[1]: Starting The Apache HTTP Server...
Apr 21 15:12:48 domian.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 21 15:12:48 domian.com systemd[1]: Failed to start The Apache HTTP Server.
Apr 21 15:12:48 domian.com systemd[1]: Unit httpd.service entered failed state.
Apr 21 15:12:48 domian.com systemd[1]: httpd.service failed.
Apr 21 18:09:59 domian.com systemd[1]: Starting The Apache HTTP Server...
Apr 21 18:09:59 domian.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 21 18:09:59 domian.com systemd[1]: Failed to start The Apache HTTP Server.
Apr 21 18:09:59 domian.com systemd[1]: Unit httpd.service entered failed state.
Apr 21 18:09:59 domian.com systemd[1]: httpd.service failed.
Apr 21 18:11:21 domian.com systemd[1]: Starting The Apache HTTP Server...
Apr 21 18:11:21 domian.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 21 18:11:21 domian.com systemd[1]: Failed to start The Apache HTTP Server.
Apr 21 18:11:21 domian.com systemd[1]: Unit httpd.service entered failed state.
Apr 21 18:11:21 domian.com systemd[1]: httpd.service failed.
Apr 21 18:15:43 domian.com systemd[1]: Unit httpd.service cannot be reloaded because it is inactive.
Apr 21 18:36:25 domian.com systemd[1]: Starting The Apache HTTP Server...
Apr 21 18:36:25 domian.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 21 18:36:25 domian.com systemd[1]: Failed to start The Apache HTTP Server.
Apr 21 18:36:25 domian.com systemd[1]: Unit httpd.service entered failed state.
Apr 21 18:36:25 domian.com systemd[1]: httpd.service failed.

80端口上没有任何东西

xxxx@domain conf.d]$ sudo netstat -tulpn | grep --color :80
[xxxx@domain conf.d]$ 

不确定还需要做什么才能启动 httpd?

sudo netstat -an 的部分输出

Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:5001          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:7373          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6062          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:1935            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:6162          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:8126          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:4352          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:4355            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:45288         127.0.0.1:6379          TIME_WAIT  
tcp        0      0 127.0.0.1:48962         127.0.0.1:6379          ESTABLISHED
tcp        0      0 127.0.0.1:6379          127.0.0.1:49170         ESTABLISHED
tcp        0      0 127.0.0.1:45610         127.0.0.1:6379          TIME_WAIT  
tcp        0      0 127.0.0.1:47764         127.0.0.1:6379          TIME_WAIT  
tcp        0      0 127.0.0.1:47626         127.0.0.1:6379          TIME_WAIT  
tcp        0      0 127.0.0.1:6379          127.0.0.1:49010         ESTABLISHED
tcp        0      0 127.0.0.1:48872         127.0.0.1:6379          ESTABLISHED
tcp        0      0 127.0.0.1:45778         127.0.0.1:6379          TIME_WAIT  
tcp        0      0 127.0.0.1:47260         127.0.0.1:6379          TIME_WAIT  
tcp        0      0 127.0.0.1:48332         127.0.0.1:6379          ESTABLISHED
tcp        0      0 127.0.0.1:45336         127.0.0.1:6379          TIME_WAIT  ```

答案1

在某些系统上,对 1024 以下端口的访问受到限制。您是否尝试在高于该端口的端口上运行或以 root 身份启动 httpd?

答案2

所以我发现其他人将旧密钥放入 cert 目录中,导致 httpd 无权绑定到端口:80。感谢大家提出的宝贵建议和答案。

相关内容