root@VM-0-12-ubuntu:~# 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()
执行一下命令:
sudo fuser -k 80/tcp
sudo fuser -k 443/tcp
无效;
root@VM-0-12-ubuntu:~# netstat -nap | grep 80
tcp6 0 0 :::80 :::* LISTEN 10887/apache2
查看80端口占用一直被apache占用,用kill命令杀也是生生不息,
最后执行
root@VM-0-12-ubuntu:~# pkill nginx
root@VM-0-12-ubuntu:~# pkill apache2
也不知道是哪个起的作用。。
然后启动:
root@VM-0-12-ubuntu:~# /etc/init.d/nginx start
Starting nginx (via systemctl): nginx.service.
然后就好了。