nginx不支持ipv6吗

问答中心分类: Nginxnginx不支持ipv6吗
dokuro asked 8 年 ago
我在配置文件里监听ipv6地址会报错
Starting nginx: nginx: [emerg] the INET6 sockets are not supported on this platform in "[::]:80" of the "listen" directive in /usr/local/nginx/conf/vhost/domain.conf:4
 
Question Tags:

3 Answers
oneinstack answered 8 年 ago
默认支持ipv6,需要自己配置监听地址

探路者 answered 8 年 ago
老大:怎么配置呢?

oneinstack answered 8 年 ago
同时监听IPV4和IPV6
server {
....
listen [::]:80;
...
}
只监听IPV6
server {
....
listen [::]:80 default ipv6only=on;
...
}
监听指定IPV6地址
server {
....
listen [3608:f0f0:3002:31::1]:80;
...
}
重启nginx
/usr/local/nginx/sbin/nginx -s reload