先看报错:
[root@localhost ~]# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
解决办法
- netstat -ntlp|grep 80 #发现80端口被一个httpd服务占用了
- kill -9 1890 #杀了2次,每次都会重新启动一个进程 --杀不掉!!
- service httpd.service stop #于是乎停掉这个服务(杀手锏)
- 小样,这回起不来了吧
- 于是重启nginx --ok,大功告成!