httpmake_sock: could not bind to address

centos7中在通过同个ip,使用不同的端口启动http服务时,出现以下错误。
[root@localhost user]# systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.

[root@localhost user]# systemctl status -l 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 四 2017-08-31 23:20:41 PDT; 12s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 11310 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)

Process: 11305 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 11305 (code=exited, status=1/FAILURE)

8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: no listening sockets available, shutting down
8月 31 23:20:41 localhost.localdomain httpd[11305]: AH00015: Unable to open logs
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
8月 31 23:20:41 localhost.localdomain kill[11310]: kill: cannot find process “”
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
8月 31 23:20:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
8月 31 23:20:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service failed.
[root@localhost user]# systemctl status -l 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 四 2017-08-31 23:20:41 PDT; 40s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 11310 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)

Process: 11305 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 11305 (code=exited, status=1/FAILURE)

8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8081
8月 31 23:20:41 localhost.localdomain httpd[11305]: no listening sockets available, shutting down
8月 31 23:20:41 localhost.localdomain httpd[11305]: AH00015: Unable to open logs
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
8月 31 23:20:41 localhost.localdomain kill[11310]: kill: cannot find process “”
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
8月 31 23:20:41 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
8月 31 23:20:41 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
8月 31 23:20:41 localhost.localdomain systemd[1]: httpd.service failed.

原因:seLinux阻止8081端口启动
解决方法:

这里写图片描述

输入这两条指令:
[root@localhost user]# ausearch -c ‘httpd’ –raw | audit2allow -M my-httpd
libsepol.sepol_string_to_security_class: unrecognized class dir
libsepol.sepol_string_to_security_class: unrecognized class tcp_socket
********** IMPORTANT *************
To make this policy package active, execute:

semodule -i my-httpd.pp

[root@localhost user]# semodule -i my-httpd.pp
[root@localhost user]# systemctl restart httpd.service

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值