Skip to content

Instantly share code, notes, and snippets.

@Ephigenia
Created October 18, 2011 10:59
Show Gist options
  • Select an option

  • Save Ephigenia/1295164 to your computer and use it in GitHub Desktop.

Select an option

Save Ephigenia/1295164 to your computer and use it in GitHub Desktop.
nginx-fb-hotlinking-hb-2
# apply this rule on any location that’s an image using Regexp
location ~* \.(png|gif|jpg|jpeg|swf|ico)(\?[0-9]+)?$ {
# block empty blocked or whiteliste referers
valid_referers none blocked horrorblog.org www.horrorblog.org ~\.google\. ~\.yahoo\. ~\.bing\. ~\.facebook\. ~\.fbcdn\.;
if ($invalid_referer) {
return 403;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment