nginx配置wordpress网站图片防盗链

修改nginx网站配置文件:

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
    valid_referers none blocked *.smilefrog.net *.google.com *.baidu.com *.bing.com;
    if ($invalid_referer) {
        rewrite ^/ https://www.smilefrog.net/wp-content/uploads/2018/08/smilefrog_no.png;
        #return 404;
    }
    expires      30d;
}

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注