Table of Contents

How to Enable IPv6 for Your Website in Nginx

Cyrus Kao
Last modified on .

According to Google's IPv6 adoption statistics, more than 30% of the Internet users are using IPv6 in 2021. In some countries, like France and Germany even have adoption rates over 50%, which makes it essential to adopt IPv6 on your website for international users.

In this guide we'll be covering how to set DNS AAAA records for your domain name to enable IPv6 connection, and configure Nginx to listen on IPv6 address.

Add DNS Records

Add DNS AAAA records pointing to your machine's public IPv6 address:

DNS management
Cloudflare's DNS management panel

Configure Nginx

Before configuring IPv6 in Nginx you'll need a working Nginx server, refer to this guide for the setup.

HTTP Server

Add listen [::]:port to your HTTP server blocks:

server {

	listen 80;
	listen [::]:80;

Nginx config

HTTPS Server

The same goes for the HTTPS server blocks:

server {

	listen 443 ssl;
	listen [::]:443 ssl;

Nginx config

Verify Content is Served Over IPv6

Open development tools of your browser, then check if Remote Address is an IPv6 address:

DevTools in Chromium

See Also


Sign in to leave a comment.