nginx针对不是图片的文件添加防盗链
location ~* (?<!\.(jpg|bmp|png|gif))$ {
valid_referers none blocked domain.com *.domain.com;
if ($invalid_referer) {
return 404;
}
}
如果需要对空来路也禁止,去掉上面none即可。