centos启动Nginx提示nginx: [emerg] still could not bind()

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)  
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)  
nginx: [emerg] still could not bind()  

这个的意思是说,nginx监听的 8080端口已经被使用了。解决方法有两种,一种是换端口,另一种是查看占用端口的进程,把它关掉。

--查询端口所在的进程号
[root@localhost www]# netstat -ntlp | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      29186/java    

--杀掉进程
[root@localhost www]# kill -9 29186

更多推荐