Cloudflare API v4 enable users to update DNS records programmatically, which made Dynamic DNS (DDNS) implementation possible. I recently wrote a CLI tool called cf-ddns-cli in Node.js to update DNS A (IPv4) and AAAA (IPv6) records with your current IP address, and it's available in Windows, Mac and Linux.
Nginx's server_name directive indicates the domain name it's listening on. But if non of the server blocks match the incoming request, it will still fall back to the last HTTP/HTTPS server block. So a direct access by IP address will probably caught by some route instead of being dropped, which is often not ideal.
Cloudflare CDN works just like a reverse proxy, it sits in front of your web servers and forwards client requests to them. So the requests reached your server actually came from Cloudflare. To restore the original client's IP address, we'll be using ngx_http_realip_module in Nginx to retrieve them from headers.
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 rate over 50%, which made it essential to adopt IPv6 on your website for the international users.
In my opinion, changing DNS servers on Linux is even easier than Windows. As you only need to do it once and it applies to all the network interfaces. In this guide we'll be covering configure DNS servers on all Linux distros and prevent DNS settings from changing by other services.