Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the fallowing configuration to disable hotlinking on nginX.

        location / {
        root   /var/www/html;
        index  index.html index.htm;

    location ~ \.(xml|jpg|jpeg)$  {
         root /var/www/html;
         valid_referers  none blocked;
         if ($invalid_referer)  {
              return 444;

I have reloaded nginX several times and I am still able to access images from facebook. I have several folders within /var/www/html.

Am I missing something?

share|improve this question

Not sure if you know , but there is a bug in nginx and if that code is in separate file (not nginx.conf , reloading won't get the changes in included file; you will need to stop/start the nginx.

Also a bit change in logic, since you listed valid referrers wouldn't it be better to say

if (!$valid_referrer)

share|improve this answer

Check refer in access log:

IP - - [20/Feb/2011:20:11:51 +0000] "GET /GET HTTP/1.1" 200 3710 "REFER" "USER_AGENT"


  • none means the absence of "Referer" header.
  • blocked means masked Referer header by firewall(non http(s))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.