Setting jitsi (or any website) to noindex/nofollow in nginx

I recently set up Jitsi Meet on my small VPS and although I have already limited room creation to registered users I didn’t want the domain showing up in Google or any other search engines. As I didn’t want to dig through Jitsi’s files looking where the html header is stored / generated I looked for another solution. As you can add X-Robots-Tag with nginx directly I decided to try this and it works.

Simply add the following to your nginx config into your server or location block:

add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";

After that just reload nginx and the new X-Robots-Tag should be set. As it doesn’t set it in the source code but the http header checking the source code doesn’t help but you can use the following site to see the currently set http headers of any website:

Of course this isn’t limited to Jitsi but works with any website running with nginx.