nginx配置防盗链
标签(空格分隔): nginx
文件后缀判断
location ~* .(gif|jpg|png|swf|flv)$ {
#允许访问该目录的域名或IP
valid_referers none blocked *.xxx.com;
if ($invalid_referer) {
#rewrite ^/ www.nginx.cn
return 403;
}
}
文件夹判断
location /img/ {
#允许访问该目录的域名或IP
valid_referers none blocked *xxx.com;
if ($invalid_referer) {
return 403;
}
}