分类: LINUX
2019-11-26 11:03:37
本文教你如何在Nginx上实现防盗链。 |
一、ngx_http_referer_module(阻挡来源非法的域名请求),配置如下:
location ~.*\. (gif|jpg|png|flv|swf|rar|zip)$ { valid_referers none blocked test.com *.test.com; if($valid_referer) { #return 403; rewrite ^/ } }
二、HttpAccessKeyMoudule,配置如下:
location ~.*\. (gif|jpg|png|flv|swf|rar|zip)$ { accesskey on; accesskey_hashmethod md5; accesskey_arg "key"; accesskey_signature "mypass$remote_addr"; }
本文地址: