谢谢你的帮助。 我最近做了以下工作:
sudo yum update
sudo httpd restart
我收到以下内容: 。
Stopping httpd: [FAILED] Starting httpd: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1 (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs [FAILED]
另外,如果我运行重启命令没有sudo service httpd restart
我收到以下消息:
rm: cannot remove `/var/run/httpd/httpd.pid': Permission deniedLED] rm: cannot remove `/var/run/httpd/httpd.pid': Permission denied Starting httpd: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf.d/vhost.conf:1 (13)Permission denied: AH00058: Error retrieving pid file /var/run/httpd/httpd.pid AH00059: Remove it before continuing if it is corrupted. [FAILED]
从你提供的东西似乎有另一个使用80端口的过程
尝试执行以下操作:
首先,您需要成为root用户才能执行它们,无论您是在命令之前添加sudo,还是在执行任何操作之前,都可以像这样切换到用户root:
su -root
并inputroot密码。
然后,继续:
netstat -tulpn| grep :80
以上命令显示使用端口80的连接列表
然后执行以下命令来终止使用端口80的进程
kill -9 <process id>
用前面的命令将屏幕上显示的进程号replace进程号。
然后执行这个命令启动httpd进程:
service httpd start
如果上述不适合你,那么试试这个
试试这个我刚才testing过的:
for i in `lsof -i :80 | grep http | awk {' print $2'}`; do kill -9 $i; done
然后执行重新启动:
service httpd restart
查看用户:
id
检查权限:
ls -l /var/run/httpd/httpd.pid
运行它得到<process id>
:
netstat -tulpn| grep :80
要查看谁运行了httpd:
ps -ef|grep <process id>
所以关于使用80或443端口的另一个进程的答案或多或less是正确的,但是这看起来像是我想分享的经典错误。 你永远不应该杀死-9 pidof httpd
或以其他方式突然杀死Apache。 如果你这样做,你会得到这个错误,直到系统终止所有其余的TCP连接到/从端口80.尝试netstat -alpn | grep':80',并检查TCP_TIME_WAIT中是否有一堆连接或类似的东西。 你必须离开Apache服务器,直到这些ALL消失。
显然你也可能有一个问题,例如在同一台机器上运行nginx或lighttpd,阻塞端口,但我敢打赌有人杀死了Apache。 所有这些连接都要等两分钟才能消失。