nginx配置图片反盗链

jopen 4年前

location ~* .(gif|jpg|png)$ {        set $local yes;        valid_referers none blocked *.hpx-party.org *.hpx-party.net;        if ($invalid_referer) {            set $local no;        }        if ($uri = /data/attachment/forum/forumid_23/11062317041367dbfb088eef3d.png) {            set $local yes;        }        if ($local = no) {            rewrite ^.*$ http://$host/data/attachment/forum/forumid_23/11062317041367dbfb088eef3d.png last;        }    }


参考文章:

http://blog.csdn.net/hu_zhenghui/article/details/8866869

http://www.wufangbo.com/nginx-fang-dao-lian/

http://www.server110.com/nginx/201310/2025.html


来自: http://my.oschina.net/u/232595/blog/604359