hotlink protection for wordpress

Max maxbear at gmail.com
Thu Feb 4 10:55:17 MSK 2010


I put this in the conf file and it works well now. I put it just under the
"access log line", I am not sure if I put it at the end of the conf, it
might not work.

location ~ \.(jpg|jpeg|png|gif)$ {
root /home/user/docs;
valid_referers none block server_names ~(domain1.com|google.);
if ($invalid_referer) {
rewrite  ^(.*)$ /wp-content/uploads/av.gif break;
               }
       }

You might also want to check this blog:
http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/

On Tue, Feb 2, 2010 at 3:50 PM, 任晓磊 <julyclyde at gmail.com> wrote:

> Yep, yesterday, I got the same mistake.
>
> It works after I put location *.gif section into location / section.
>
> One who ask this question should check your error.log for information.
>
> 2010/2/2 Igor Sysoev <igor at sysoev.ru>:
> > Have you look in error log ? Probably, you should add "root" in
>
> --
> Ren Xiaolei
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100204/80cada01/attachment.html>


More information about the nginx mailing list