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

来源:互联网 发布:行业经济数据表格 编辑:程序博客网 时间:2024/05/01 03:10

该问题是由SELinux 引起的(注本人的环境为centos 6.0)

解决办法有两个:

1.快速解决(不推荐)


vi /etc/sysconfig/selinuxSELINUX=enforcing =>SELINUX=disabledreboot


2.从根上解决(推荐)

根据自己的需求在selinux中添加需要指定的端口


a)前提需要先安装semanage(Centos6.0默认没有安装该应用) 

安装方式参看 RHEL 6: semanage SELinux Command Not Found

也可以参看 http://wiki.centos.org/HowTos/SELinux

# yum provides /usr/sbin/semanageor#yum whatprovides /usr/sbin/semanage#yum -y install policycoreutils-python#semanage

b)使用semanage添加apache侦听的端口

参看 http://hi.baidu.com/5212521/blog/item/0b998b1bdb15c7018618bf8c.html 或 http://hi.baidu.com/ldtrain/blog/item/59c9bb1e242247fee0fe0b5b.html

查看现在的支持http的端口有哪些

#semanage port -l|grep http

为http服务添加新的端81

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

查看添加的结果

#semanage port -l|grep http