How to block search engines in the nginx

19 February 2018

If you have three layered development structure (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 forgets the way to goes to your server.

Tags: devops nginx seo