Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
146 views
in Technique[技术] by (71.8m points)

What does [::] mean in my nginx config file

I was looking at my nginx config file I noticed two this.

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    index index.html;
}

I understand this part listen 80 default_server; it tells nginx to listen on port 80 and set that as the "default_server" but I do not understand the second line.

listen [::]:80 default_server;

It appears I am setting the default server again on port 80 but I do not really understand the [::] part of it at all.

Can someone explain to me what this configuration does?

question from:https://stackoverflow.com/questions/34305351/what-does-mean-in-my-nginx-config-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is for the IPv6 configs

from the nginx docs

IPv6 addresses (0.7.36) are specified in square brackets:

listen [::]:8000;
listen [::1];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...