![Nginx 动态配置重新加载导致错误](https://linux22.com/image/798003/Nginx%20%E5%8A%A8%E6%80%81%E9%85%8D%E7%BD%AE%E9%87%8D%E6%96%B0%E5%8A%A0%E8%BD%BD%E5%AF%BC%E8%87%B4%E9%94%99%E8%AF%AF.png)
我尝试运行“nginx -c /etc/nginx/nginx.conf”,但得到:
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()
[Exit 1]
然后我运行
fuser -k 80/tcp ; service nginx restart.
我再次尝试使用“nginx -c /etc/nginx/nginx.conf”,但仍然出现相同的错误“[emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”
为什么会发生这种情况?
答案1
这不是你重新加载 nginx 的方法。
你正在尝试的是启动 nginx再次,-c
仅指定应使用的配置文件。
使用service nginx reload
或/etc/init.d/nginx reload
重新加载它。