在apache中绑定非http标准端口时,一直出现以下的错误提示:
[root@localhost ~]# /etc/init.d/httpd start
Starting httpd: (13)Permission denied: make_sock: could not bind toaddress 0.0.0.0:888
no listening sockets available, shutting down
Unable 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 httpdstartpython
semanage这个工具默承认能没有装,须要先安装一下。linux
可使用以下命令查看这个工具在那个package里:apache
# yum provides /usr/sbin/semanage
socket
ortcp
# yum whatprovides /usr/sbin/semanage
ide
输出:工具
Loaded plugins: rhnplugin
rest
policycoreutils-python-2.0.83-19.8.el6_0.x86_64 : SELinux policy core python utilities Repo : rhel-x86_64-server-6
code
Matched from:
server
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 #强制模式