How to enable IPv6 on Nginx

by Ruchira on April 23, 2013

ipv6
We all know that IPv4 addresses are depleting really fast. But still IPv6 adoption is nowhere near it should be. For example IPv6 adoption in mexico is 0.00% as of Google Ipv6 statistics report . Even though the IPv6 adoption among the internet users is low, most Dedicated and Virtual Private Server providers are already offering IPv6 support. But in reality most users don’t know how to configure IPv6 for their web sites and the most widely used hosting control panel “Cpanel” still doesn’t support IPv6. But if you are using Nginx on your server you are lucky because enabling IPv6 , IPv4 dual stack support is really easy.

If you are using the Nginx autoinstaller which is listed on my site, Nginx is already configured to include IPv6 support.

You can verify this by issuing below command

/usr/local/nginx/sbin/nginx -V

nginx-v

 

 

You can see that Nginx is configured to use IPv6 by the arguement “–with-ipv6” . Now lets proceed to enable IPv6 by editing the nginx.conf file.

Nginx.conf is located in /usr/local/nginx/conf/nginx.conf to edit this issue below command

nano /usr/local/nginx/conf/nginx.conf

This will open up the nano editor and find the place where it says listen 80; and replace it with listen [::]:80; and save it by using Ctrl+O and then exit using Ctrl+X .

nginx-ipv6

 

Now you are done, We just need to restart or reload the LNMP stack and it will just work.

Restart using

/root/lnmp restart

That’s it. If you have configured AAAA records to point at your server. IPv6 will be working now. You can validate it using http://ipv6-test.com/validate.php

I'm Ruchira Sahan and all posts on this blog are completely my thoughts and writings. I love DIY and Technology. So feel free to contact me for anything about this blog and don't forget to add a comment if this blog helped you! Thanks
Ruchira
View all posts by Ruchira

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: