我很惊讶因为:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 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:443 failed (98: Address already in use)
启动Nginx时,所以我认为Nginx或其他在端口上运行。我测试过:
lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 13557 www-data 8u IPv4 100729 0t0 TCP *:http (LISTEN)
nginx 13558 www-data 8u IPv4 100729 0t0 TCP *:http (LISTEN)
是的,Nginx正在工作,实际上网页正在运行。一切都很完美,但......不是!
怎么可能这个?
service nginx status
[FAIL] nginx is not running ... failed!
没有跑?但我无法启动任何其他实例,因为它正在运行!发生了什么事?
重新启动时相同:
service nginx restart
Restarting nginx: Enter PEM pass phrase:
Enter PEM pass phrase:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 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:443 failed (98: Address already in use)
提前致谢。
答案 0 :(得分:4)
检查nginx是否正在运行:
ps aux | grep nginx
如果存在nginx进程,那么它肯定会运行。您使用lsof验证的仅证明80端口被某个进程占用(例如,apache httpd或其他一些http服务器)。如果nginx进程没有运行但是正在使用80端口,这也解释了为什么你不能启动你的nginx。在这种情况下,您需要在进程列表中查找以查看哪个Web服务器已在运行。杀死它并重新启动nginx,它应该可以正常工作。