状况A
重启Apache时,报错:
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs
可能是80端口被占用。
安装工具 netstat:
yum install net-tools -y
使用 netstat 查看进程:
netstat -lnp|grep 80
输出:
tcp 0 0 :::80 :::* LISTEN 846/httpd
找到pid 846:
ps 846
关闭pid 846:
kill -9 846
重启Apache:
service httpd restart
启动成功!
状况B
经过状况A的处理,依然无法奏效。
netstat -lnp|grep 80
输出:
tcp 0 0 :::80 :::* LISTEN 14482/httpd ...
kill -9 14482
然后查看:
netstat -lnp|grep 80
输出:
tcp 0 0 :::80 :::* LISTEN 14483/httpd ...
发现并未杀死,只是14482变成了14483。
此时,应该使用如下命令:
killall -9 httpd
然后查看:
netstat -lnp|grep 80
输出结果中80端口已释放。
现在可以重启httpd了:
service httpd start
输出:
Starting httpd: [ OK ]
参考:http://www.9enjoy.com/post/187/
参考:http://www.cnblogs.com/yuboyue/archive/2011/07/18/2109875
参考:http://www.jb51.net/LINUXjishu/55990