nginx USES the configuration item description for IPV6

  • 2020-05-12 06:28:29
  • OfStack

IPV4 is increasingly scarce, ipv6 has been slowly on the agenda, ipv6 in the domestic popularity, nginx configuration ipv6 is sure to use nginx, see how to make nginx support ipv6 and configuration.

See if nginx supports ipv6


# /usr/local/nginx-1.7.0/sbin/nginx -V
nginx version: nginx/1.7.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
configure arguments: --prefix=/usr/local/nginx-1.7.0 --with-http_stub_status_module

The current nginx does not support ipv6, so we need to recompile nginx and add the with-ipv6 in the configuration. I will not tell you how to install it. By default, ipv6 is already enabled for nginx 1.

Listen for IPV4 and IPV6 at the same time


server {
....
listen [::]:80;
...
}


Only to monitor IPV6


server {
....
listen [::]:80 default ipv6only=on;
...
}

Listen to the specified IPV6 address

server {
....
listen [3608:f0f0:3002:31::1]:80;
...
}

Restart nginx

/usr/local/nginx-1.7.0/sbin/nginx -s reload


Related articles: