分类: 系统运维
2009-12-05 21:51:36
nginx的防盗链配置:
location ~ .*\.(jpg|png|swf)$ {
root /opt/www_data/code/public_html;
valid_referers none blocked server_names file1.test.com *.test.com test.com;
if ($invalid_referer) {
rewrite ^/ test.com/images/include/logo.png;
#return 404;
}
}
配置说明:
判断后缀为jpg、png、swf的文件进行防盗链,指定来路为gonline.com的域名及子域名,if判断非gonline.com的域名转到test.com/images/include/logo.png或返回404状态。