apache2.x修改默认端口后报 Starting httpd: (13)Permission denied: make_sock: could not bind to address

浏览: 6282
问题描述:
在apache中绑定非http标准端口时,一直出现如下的错误提示:
[root@localhost ~]# /etc/init.d/httpd start
Starting httpd: (13)Permission denied: make_sock: could not bind to address 0.0.0.0:8087
no listening sockets available, shutting down
Unable to open logs

原因分析:该问题是由SELinux 引起的

解决方案:
解决办法有两个
1、快速解决,修改selinux级别(不推荐)
vi /etc/sysconfig/selinux  
SELINUX=enforcing =>SELINUX=disabled
reboot


2、从根本上解决(推荐)
根据自己的需求在selinux中添加需要指定的端口
前提需要先安装semanage(Centos6.0默认没有安装该应用)
a)安装方式如下:
[root@localhost /]# yum provides /usr/sbin/semanage  
[root@localhost /]# yum whatprovides /usr/sbin/semanage
[root@localhost /]# yum -y install policycoreutils-python
[root@localhost /]# semanage


b)使用semanage添加apache侦听的端口
查看现在的支持http的端口有哪些
[root@localhost /]# semanage port -l|grep http
为http服务添加新的端81
[root@localhost /]# semanage port -a -t http_port_t -p tcp 81
查看添加的结果
[root@localhost /]# semanage port -l|grep http

推荐 1
本文由 梁勇 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

0 个评论

要回复文章请先登录注册