nginx 配置防盗链

编辑配置文件:
vim /usr/local/nginx/conf/vhosts/test.conf

加入:
location ~ .*.(gif|jpg|jped|png|bmp|swf|flv|rar|zip|gz|bz2)$

{
        access_log off;
        expires 15d;
        valid_referers none blocker server_names *.taobao.com *.test.com *.aaa.com *.apelearn.com;
        if ($invalid_referer)
        {
        return 403;

        }
}