New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
nginx frontend proxy for apache and hotlink protection
ndelaespada
Member, Host Rep
in Help
I have a server running nginx as frontend proxy for apache and i'm trying to configure hotlink protection, the server has mostly mp3s and hotlink is killing bw, I have the following in the site config file:
location ~* (\.bin|\.zip|\.mp4|\.mp3|\.jpg|\.png)$ { valid_referers blocked mysite.com www.mysite.com *.google.com *.bing.com *.yahoo.com; if ($invalid_referer) { return 405; }
but for some reason the only extension getting blocked is .bin, everything else loads without restriction.
Can anyone shed some light? I've tried several suggestions I've found on the net without any luck
Comments
I have never bothered much, if any, with hotlink protection, but I can tell you two things right off the bat:
1) never ever blindly copy/paste configurations
2) don't use "if" statements with Nginx; that is a really old, outdated, and bad way of doing things.
That being said, check out http://www.kbeezie.com - he knows his way around Nginx, he works with us, and his is a Nginx contributor.
Perhaps other extensions are being handled by other, prior, directives.
You can simplify it like this:
Thank was exactly it! thanks!
Thanks, just applied that change,