今天在作LNMP的時候,啓動nginx服務,沒法開啓,致使網頁打不開。把服務從起一下發現提示錯誤以下:nginx
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)service
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()程序
問題描述:地址已被使用。可能nginx服務卡死了,致使端口占用,出現此錯誤。方法
解決方法:首先用lsof:80看下80端口被什麼程序佔用。lsof返回結果以下:端口
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 3274 root 6u IPv4 10664 0t0 TCP *:http (LISTEN)
nginx 3547 nginx 6u IPv4 10664 0t0 TCP *:http (LISTEN)vi
發現是nginx程序,因此咱們把nginx服務k掉,從新啓動服務。。命令以下:bind
kill -9 3274co
kill -9 3547錯誤
service nginx starttar
Starting nginx: [ OK ]
OK了,服務成功啓動!~~