How to Enable IPv6 in Nginx?

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this short post, we will show you how to enable IPv6 on Nginx. This step is important to make our website or web application available in more ways.

It is really important to enable IPv6 on Nginx

As we all know IPv6 is the natural evolution of the IP protocol. This version not only increases the number of possible IP addresses in the world but also adds a little more performance in the requests that are made.

If we add to this the fact that more and more IPv6 is present in almost all Internet providers in the world, then it is convenient to enable it.

First, IPv6 has a performance advantage over IPv4, which means that requests and load times are better. Secondly, because every day the migration is continuous and you can possibly be left without access to the site or with some problems.

So, to avoid any mishap, it is better to enable IPv6 on Nginx.

Enabling IPv6 on Nginx

We assume that Nginx is installed and running on the system. We already know that on Debian-derived systems like Ubuntu and family we have to run

sudo apt install nginx
1.- Install Nginx on Linux
1.- Install Nginx on Linux

After this, we have to edit the main Nginx file

sudo nano /etc/nginx/nginx.conf

And inside the server section

section add the following

listen [::]:80
2.- Enabling IPv6 on Nginx
2.- Enabling IPv6 on Nginx

This will be enough to indicate that all requests from any IPv6 address are accepted on port 80.

Also, you can specify an IPv6 address

listen [xxxxxx]:80

And if you add the ipv6only=on; directive then you will force the server to only take IPv6 requests

listen [::]:80 default_server ipv6only=on;

Save the changes and close the text editor.

Restart Nginx to apply the changes.

sudo systemctl restart nginx

To check the changes run the following command

netstat -anlp | grep 80
3.- IPv6 enabled on Nginx
3.- IPv6 enabled on Nginx

And on the output screen, you will notice that it is listening for tcp6 implying that the process has been successful.

So, enjoy it.

Conclusion

Now you know how to enable IPv6 on a web server like Nginx. This way, they can now access your server in another reliable way.

Apply it on your server.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook