How to block search engines in the nginx

Hey, y’all 🖖🏽 I am a passionate self-taught developer, open-source advocate, and tech enthusiast with a hands-on approach to problem-solving and an unending thirst for knowledge. Anything and everything classified as technology fascinate me.
If you have three layered development structures (local dev, remote staging, remote production) like me, you want to search engines index your staging server. It is easy to prevent search engines from indexing your Nginx web server.
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
Add the line above in the server block virtualhost file and Google forget the way to go to your server.






