Cloudflare API v4 enables users to update DNS records programmatically, which makes 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 none of the server blocks match the incoming request, it will still fall back to the last HTTP/HTTPS server block. So direct access by IP address will probably be 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 reaching 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 rates over 50%, which makes it essential to adopt IPv6 on your website for international users.
In my opinion, changing DNS servers on Linux is even easier than in Windows. As you only need to do it once and it applies to all the network interfaces. In this guide we'll be covering how to configure DNS servers on all Linux distros and prevent DNS settings from changing by other services.