防盗链一般都是流媒体配置
location ~* .(jpg|jpeg|png|bmg|swf|mp4|mp4|mmf|zip|rar|swf|flv)$ { // 对jpg|jpeg|png|bmg|swf|mp4|mp4|mmf|zip|rar|swf|flv 实行防盗链处理; valid_referers none blocked *.www1.com www1.com; // www1.com 这个请求可以正常访问上面指定文件资源; if ($invalid_referer) { rewrite ^/ http:## //www.www1.com/img/error.gif; #return 403; } }
location /images { root /nginx/web/html; valid_referers none blocked *.www1.com www1.com if ($invalid_referer) { return 403; } }