本人系统CentOS 6.5 64bit, Apache HTTP Server的版本为2.2.15。
启动http服务时出现如下错误:
[root@lls ipc]# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using lls.pc for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:8099
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8099
no listening sockets available, shutting down
Unable to open logs
[FAILED]
错误原因在于SELinux 安全机制的作用,现在来逐个解决问题。
1.
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using lls.pc for ServerName
表示没有确切地定义主机名。
在配置文件/etc/httpd/conf/httpd.conf中修改,将被注释掉的ServerName名字改为自己的主机名,查看主机名:
[root@lls ipc]# hostname
lls.pc
于是将被屏蔽掉的ServerName修改为:
ServerName lls.pc
2.
(13)Permission denied: make_sock: could not bind to address [::]:8099
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8099
no listening sockets available, shutting down
Unable to open logs
表示系统系统中没有为http服务定义8099端口,查看http端口:
[root@lls ipc]# semanage port -l | grep http
http_cache_port_t tcp 3128, 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
查看http_port_t,系统果然没有为http服务定义8099端口,于是添加8099端口并再次查看http服务的端口:
[root@lls ipc]# semanage port -a -t http_port_t -p tcp 8099
[root@lls ipc]# semanage port -l | grep http
http_cache_port_t tcp 3128, 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 8099, 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
可以看到,在http_port_t中增加了8099。
重新启动http服务:
[root@lls ipc]# /etc/init.d/httpd start
Starting httpd: [ OK ]
Ok,启动成功。
参考:
[1]http://blog.163.com/darkness@yeah/blog/static/13177448420116991252712/
[2]http://blog.csdn.net/maoxiang/article/details/5720464