Nginx 最全操作总结 https://mp.weixin.qq.com/s/LmtHTOVOvdcnMBuxv7a9_A
server {
listen 80;
server_name *.test;
# 图片防盗链
location ~* .(gif|jpg|jpeg|png|bmp|swf)$ {
valid_referers none blocked server_names ~.google. ~.baidu. *.qq.com; # 只允许本机 IP 外链引用,将百度和谷歌也加入白名单有利于 SEO
if ($invalid_referer){
return 403;
}
}
}