location ~* (.jpg|.png|.gif|.jpeg|.png)$ { valid_referers none blocked www.centos.bz centos.bz; if ($invalid_referer) { return 403; } }下面這種防盜鏈方法是,當有人盜鏈時,直接顯示我們預設的一張圖片。
location ~* (.jpg|.png|.gif|.jpeg|.png)$ { valid_referers none blocked www.centos.bz centos.bz; if ($invalid_referer) { rewrite ^/images/(.*).(gif|jpg|jpeg|png)$ http://www.centos.bz/banner.jpg last } }