Created
March 2, 2017 07:43
-
-
Save Hotfirenet/2de1c8aa3bfe1b8944a387d174a3af68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* \.(gif|png|jpe?g)$ { | |
expires 7d; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
# prevent hotlink | |
valid_referers none blocked ~.google. ~.bing. ~.yahoo. server_names ~($host); | |
if ($invalid_referer) { | |
rewrite (.*) /static/images/hotlink-denied.jpg redirect; | |
# drop the 'redirect' flag for redirect without URL change (internal rewrite) | |
} | |
} | |
# stop hotlink loop | |
location = /static/images/hotlink-denied.jpg { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment