IPV4 increasingly scarce, IPv6 has slowly embarked on the agenda, to IPv6 in the domestic popularization, the use of nginx configuration IPv6 that is for sure, see how to let Nginx support IPv6 and configuration.
See if Nginx supports IPv6
Copy Code code as follows:
#/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
No –with-ipv6, indicating that the current nginx does not support IPv6, so we need to recompile nginx, configure the Add –with-ipv6, specifically how to install, I am not long-winded. General YNM installation of the Nginx default has been opened IPv6.
While listening to IPV4 and IPV6.
Copy Code code as follows:
server {
....
Listen [::]:80;
...
}
Monitor IPV6 only
Copy Code code as follows:
server {
....
Listen [::]:80 default Ipv6only=on;
...
}
Listen for the specified IPV6 address
Copy Code code as follows:
server {
....
Listen [3608:f0f0:3002:31::1]:80;
...
}
Restart Nginx
Copy Code code as follows:
/usr/local/nginx-1.7.0/sbin/nginx-s Reload