Ravinder-Sharma How to block DigitalOcean server's ip for public. (To avoid hackers) Because the website runs only with the domain name, why not stop the public ip of the server like cloudways.com does. You can see the article of cloudways << here.
jond1 The safest way is to use a Cloudflare-like service as a reverse proxy, then only allow the reverse proxy to access the webserver.
portofacil You might edit /etc/nginx/sites-enabled/default and serve whatever you want from there (or even a return 403).