错误提示:

Starting nginx:nginx:[emerg]bind()to 0.0.0.0:80 failed(98:Address alreadr 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()

根据错误判断应该是80端口的问题,于是我查看了一下80端口占用情况。

#lsof -i:80

[root@chensenlin sbin]# lsof -i:80COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAMEnginx   4005   root    6u  IPv4  14957      0t0  TCP *:http (LISTEN)nginx   4013 nobody    6u  IPv4  14957      0t0  TCP *:http (LISTEN)


然后将这两个进程kill。

[root@chensenlin sbin]# kill -9 4005[root@chensenlin sbin]# kill -9 4013

最后启动成功!

[root@chensenlin sbin]# service nginx startStarting Nginx:                                                 [      OK    ]