1、nginx针对文件类型的防盗链配置方法:
location ~* \.(gif|jpg|png|swf|flv|bmp)$ {
valid_referers none blocked lirongyao.com;
if ($invalid_referer) {
#rewrite ^/ http://lirongyao.com/403.html;
return 403;
}
}
2、nginx针对文件目录的防盗链配置方法:
location /img/ {
root /data/img/;
valid_referers none blocked lirongyao.com;
if ($invalid_referer) {
rewrite ^/ http://lirongyao.com/error.gif;
#return 403;
}
}
原创文章,转载请注明: 转载自荣耀博客
本文链接地址: Nginx防盗链配置
本文链接地址: Nginx防盗链配置