Block referrer url in nginx

From DevOps Notebook

In order to block referral url in nginx, add in server block:

if ($http_referer ~* badwebsite.com) {
   return 403;
}