httpd 13 permission denied make_sock could not bind to address 失败的原因

本文介绍了CentOS下启动Httpd遇到的问题及解决方法。由于SELinux的安全限制,Httpd无法绑定到预定义的8000端口。通过使用semanage命令修改端口分配,并调整Httpd配置指向新的端口81,最终成功启动了服务。

CentOS 下启动Httpd 失败,报

 

 (13)Permission denied: make_sock: could not bind to address [::]:8000

 

 

 因为 小于1024 的端口只能是ROOT占用,但8000已经大于这个数值。

 

 

 Google 一下,发现原来是 SELinux  安全机制的作用。

 

  查看一下预定义

  #semanage port -l
 

http_cache_port_t              tcp      3128, 8080, 8118, 11211, 10001-10010
http_cache_port_t              udp      3130, 11211
http_port_t                         tcp      80, 443, 488, 8008, 8009, 8443

soundd_port_t                  tcp      8000, 9433, 16001

 原来8000 已经被预定义占用了,所有不能使用8000端口。

 

  # semanage port -a -t http_port_t -p tcp 81

 

 为Http 服务增加一个端口 81 ,同时将httpd 的端口改成 81 ,启动成功。

 

 

 

[root@localhost ally]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since 二 2025-07-01 18:34:41 CST; 2min 29s ago Docs: man:httpd(8) man:apachectl(8) Process: 114971 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) Process: 114982 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 114982 (code=exited, status=1/FAILURE) 7月 01 18:34:41 localhost.localdomain systemd[1]: Starting The Apache HTTP Server... 7月 01 18:34:41 localhost.localdomain httpd[114982]: AH00558: httpd: Could not reliably determine the server's...sage 7月 01 18:34:41 localhost.localdomain httpd[114982]: (13)Permission denied: AH00072: make_sock: could not bind...8081 7月 01 18:34:41 localhost.localdomain httpd[114982]: (13)Permission denied: AH00072: make_sock: could not bind...8081 7月 01 18:34:41 localhost.localdomain httpd[114982]: no listening sockets available, shutting down 7月 01 18:34:41 localhost.localdomain httpd[114982]: AH00015: Unable to open logs 7月 01 18:34:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE 7月 01 18:34:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server. 7月 01 18:34:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state. 7月 01 18:34:41 localhost.localdomain systemd[1]: httpd.service failed. Hint: Some lines were ellipsized, use -l to show in full.
07-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值