Setup DNS with NGINX

The standard domain for example.com generally corresponds to a virtual host file termed as /etc/nginx/sites-enabled/www.example.com.

To incorporate your preferred domain into a server, modify the file and locate the server block:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.example.com example.com;

In such a scenario, your website will be reachable via your domain.

Furthermore, if you wish to reach your site by utilizing an IP address, you can simply use an underscore (_) for the server name, e.g:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name _;

Lastly, don't forget to reload NGIN to apply the changes.

sudo systemctl reload nginx