nginx实现图片防盗链(referer指令)

发表于 : 2017-10-25   · CC BY-NC-SA 4.0 ·   1603 人浏览
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico|css|js)$
{
valid_referers *.hak.red hak.red baidu.com *.baidu.com;
if ($invalid_referer){rewrite ^/ https://error.hak.red/403;}
access_log off; 
expires 30d; 
}

 

Nginx tengine centos