image.png

在nginx.conf的server配置项中加入

1.访问返回403

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

2.访问跳转指定网站

if ($http_referer ~* "xxx.com") {
rewrite ^/ http://www.xxx.com/;}

3.禁止多域名

if ($http_referer ~* "xxx.com|aaa.com") {
rewrite ^/ http://www.xxx.com/;}