想建立一个测试用的虚拟主机,遇到了这个问题:
[root@localhost html]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.termwikidev for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs
解决办法:
semanage port -l|grep http
semanage port -a -t http_port_t -p tcp 81
这个两个命令一是查看,一个是添加,添加完再查看一遍,如果有81,则成功。另可能要以root用户运行。
此外,如果要外网访问,还要打开linux的防火墙:
[root@localhost html]# vim /etc/sysconfig/iptables
[root@localhost html]# service iptables restart
重启apache.
相关资料:
starting httpd 13 permission denied make_sock could not bind to address2010年01月19日 星期二 11:33In Fedora Core 5/6 and RHEL 5. We have made it easier to customize certain common parts of SELinux. In previous releases of SELinux if you wanted to change simple things like which port a daemon could listen to, you would need to write policy. Now we have the semanage utility.
SELinux assigns types to all network ports on a system. By default all ports are less then 1024 are labeled reserved_port_t and all ports > 1024 are labeled port_t. If a port is assigned to a particular type
say the http port 80, it has an assigned type of http_port_t. If you want to look at all the assigned ports in SELinux, you can use the semanage tool, semanage port -l.
So if you executed
semanage port -l | grep http
http_cache_port_t tcp 3128, 8080, 8118
http_cache_port_t udp 3130
http_port_t tcp 80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
Here we see http_port_t is assigned to ports 80, 443, 488, 8008, 8009, 8443
The policy is written to allow httpd_t http_port_t:tcp_socket name_bind;
This means the apache command can "bind" to an port that is labeled http_port_t.
So lets say you want to run httpd on port 81.
So you edit /etc/httpd/http.conf
and change this line
Listen 80
to
Listen 81
Now restart the daemon.
service httpd restart
Stopping httpd: [ OK ]
Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs
[FAILED]
Now the daemon fails to start because it can not bind to port 81.
This generates an AVC that looks like
----
time->Tue Dec 12 17:37:49 2006
type=SYSCALL msg=audit(1165963069.248:852): arch=40000003 syscall=102 success=no exit=-13 a0=2 a1=bf96a830 a2=b5b1e8 a3=9e58b68 items=0 ppid=21133 pid=21134 auid=3267 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts10 comm="httpd" exe="/usr/sbin/httpd" subj=user_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(1165963069.248:852): avc: denied { name_bind } for pid=21134 comm="httpd" src=81 scontext=user_u:system_r:httpd_t:s0 tcontext=system_u:object_r:reserved_port_t:s0 tclass=tcp_socket
To fix this you can use semanage to add the port
semanage port -a -t http_port_t -p tcp 81
service httpd start
Starting httpd: [ OK ]
Permission denied: make_sock: could not bind to address [::]:81 Apache 虚拟主机
精选 转载
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
ubuntu系统ssh远程的时候提示'Permission denied (publickey).'的处理方法
ssh连接问题
解决方法 重启 ubuntu sshd ssh无法连接 -
解决:Permission denied: make_sock: could not bind to address
系统中出现:permission denied make_sock could not bind to address 843的问题,这里分享下我的解决方法,有遇到类似问题的朋友,可以看看。在进行业务系统测试时,发现843端口sock连接有问题,通过抓包发现客户端连接843端口的tcp3次握手最后一次失败。现有的843端口是研发写的程序监听端口,判断程序不稳定,准备安装http服务然后将监听端口改
服务器 address permission available listening -
httpd 13 permission denied make_sock could not bind to address 失败的原因
CentOS下启动Httpd失败,报(13)Permissiondenied:make_sock:couldnotbindtoaddress[::]:8000因为小于1024的端口只能是ROOT占用,但8000已经大于这个数值。Google一下,发现原来是SELinux安全机制的作用。查看一下预定义#semanageport-lhttp_cache_port_ttcp3128,8080,8118,
tcp semanage make_sock http_port_t -
Apache 出现make_sock: could not bind to address 0.0.0.0:80...
前几天安装好的Apache server,今天启动时,不知怎么地,总是
linux apache 无法启动 百度 迅雷