您尚未登录。

#1 2011-11-28 18:07:09

phoenixlzx
にゃんぱすー
注册时间: 2011-08-19
帖子: 1,767
个人网站

Nginx绑定IPv4和IPv6时80端口占用的解决

没有任何其他程序占用80端口,而是nginx自己先绑定了80端口,又重复绑定而造成的。有些人建议在nginx.conf文件中添加

listen [::]:80;

而事实上这种做法会导致重复绑定:

Starting nginx daemon: nginx[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: still could not bind()
nginx already running.

在Nginx论坛看到的,同时绑定IPv4和IPv6地址时应当写为:

listen 80;
listen [::]:80 ipv6only=on;

重启Nginx即可。

离线

页脚