0

Can somebody tell me why this snippet return 404 when I'm trying to access images directly or from the original site (by link).

       location ~* \.(ico|jpeg)$ {
            valid_referers none blocked example.com *.example.com;
            if ($invalid_referer) {
                return   403;
            }
        }

As far as I understand it should return 403 for non original sites. Why it returns 404? If I disable this snippet everything is accessible again (as normal).

Now it sits inside server block.

Should I put it inside server's block / location?

Andrew
  • 105
  • 1

1 Answers1

1

Most probably you don't have a root directive in your server block so nginx is unable to locate the files.

AlexD
  • 8,179
  • 2
  • 28
  • 38