Enable IPv6 support in Nginx


Nginx is a web server which is commonly used as a reverse proxy and load balancer to manage incoming traffic.

IPv6 provides a much larger address pool (128-bit address) than IPv4 (32-bit address) so that many more devices can be connected to the internet. It also improves addressing and routing of network traffic.

Following are the set of instructions to enable IPv6 on Nginx.

You should already have a configuration as follows which supports IPv4 in your default.conf file.

http

Or https

Now you can update your Nginx configuration with following lines which supports IPv6 as well as IPv4

For http

For https

In both of the above screenshots, 80 and 443 without [::]: suggests IPv4 and with [::]: suggests IPv6 support.

If you want a server block that only supports IPv6 not IPv4, then use ipv6only flag.

http

Or https

If you want to bind a single IP 

http

Or https

The last step is to update the AAAA record of your domain at the registrar. Once updated you can use the network which assigns IPv6 to your device/computer and check the reachability over IPv6.

Leave A Comment

Your email address will not be published. Required fields are marked *