Menu Close

Nginx/Openresty | invalid port in resolver

I have been trying to specify DNS server as resolver in Openresty, but having issue with specifying IPv6 DNS server.

My config looks like this

server{
    ...
    resolver 8.8.8.8 2001:4860:4860::8888;
    ...
}

But Openresty complaints about invalid prt on IPv6

2021/10/26 20:50:35 [emerg] 996#996: invalid port in resolver "2001:4860:4860::8888" in /etc/openresty/nginx/conf/sites-enabled/default:9

Solution

The right way to type in DNS nameservers are by enclosing them within square bracket

server{
    ...
    resolver 8.8.8.8 [2001:4860:4860::8888];
    ...
}

If you need to specify port, just append the port after the bracket

server{
    ...
    resolver 8.8.8.8 [2001:4860:4860::8888]:5353;
    ...
}
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x