存档

文章标签 ‘防盗链’

nginx模块referer_module防盗链

2010年7月15日 eric 9 条评论

你的站点是不是图片、视频比较多,本身流量就很大,再有大量的盗链,很容易就把服务器击垮的,所以web站点防盗链很重要的。nginx referer_module 模块可以简单来防止盗链。

模块说明:
This module makes it possible to block access to the site with the incorrect values of line “Referer” in the request header.

Keep in mind that it is easy to spoof this header; therefore, the purpose of using of this module consists not in 100% blocking of these requests, but in the blocking of the mass flow of requests, made from typical browsers. Also, consider that the typical browser does not always provide a “Referer” header, even for correct requests.

Example

location /photos/ {
valid_referers none blocked www.mydomain.com mydomain.com;

if ($invalid_referer) {
return 403;
}
}

分类: nginx 标签: ,