在apache中绑定非http标准端口时,一直出现如下的错误提示:
[root@localhost ~]# /etc/init.d/httpd startStarting httpd: (13)Permission denied: make_sock: could not bind toaddress 0.0.0.0:888no listening sockets available, shutting downUnable to open logs[FAILED]解决方案一:增加selinux中http的端口semanage port -l|grep http #查看SELinux下http相关端口semanage port -a -t http_port_t -p tcp 888 #增加这个非标准端口即可[root@localhost ~]# /etc/init.d/httpd restart 或者 service httpdstartsemanage这个工具默认可能没有装,需要先安装一下。
可以使用如下命令查看这个工具在那个package里:
# yum provides /usr/sbin/semanage
or
# yum whatprovides /usr/sbin/semanage
输出:
Loaded plugins: rhnplugin
policycoreutils-python-2.0.83-19.8.el6_0.x86_64 : SELinux policy core python utilities Repo : rhel-x86_64-server-6
Matched from:
Filename : /usr/sbin/semanage policycoreutils-python-2.0.83-19.1.el6.x86_64 : SELinux policy core python utilities
Repo : rhel-x86_64-server-6
Matched from:
Filename : /usr/sbin/semanage
# yum -y install policycoreutils-python
解决方案二:
直接把selinux关掉。
selinux有3个膜式:
Enforcing:强制模式
Permissive:警告模式
Disabled:关闭模式
查看SELinux命令:getenforce
关闭SELinux命令:setenforce 0 #警告模式关闭SELinux命令:setenforce 1 #强制模式