Starting nginx: nginx: [emerg] the INET6 sockets are not supported on this platform in “[::]:80”

nginx不支持ipv6吗?
 
我在配置文件里监听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
 
已邀请:

张三俗

赞同来自: 九月天 super 叫兽 比尔盖茨

默认支持ipv6,需要自己配置监听地址。
 
同时监听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

要回复问题请先登录注册