Disable hotlinking protection for specific file!

Hello,

   The root directory path is /var/www/html/domain and every file

within it is hotlink protected for (mp4). Now here’s a file named
/var/www/html/domain/videos/test.mp4 and i want this file to be
available
for public with no hotlinking restriction. Is that possible with nginx ?
vhost config is given below. Please help me regarding it.

server {
listen 80;
server_name mydomain.com;
client_max_body_size 800m;
limit_rate 250k;
access_log /websites/theos.in/logs/access.log main;

    location / {
        root   /var/www/html/domain;
        index index.html index.htm index.php;
       autoindex off;

}

location ~ -720.(mp4)$ {
mp4;
expires 7d;
limit_rate 1000k;
root /var/www/html/domain;
valid_referers none blocked test.com *.test.com *.
facebook.com *.twitter.com;
if ($invalid_referer) {
return 403;
}
}
location ~ -480.(mp4)$ {
mp4;
expires 7d;
limit_rate 250k;
root /var/www/html/domain;
valid_referers none blocked test.com *.test.com *.
facebook.com *.twitter.com;
if ($invalid_referer) {
return 403;
}
}
location ~ .(mp4)$ {
mp4;
expires 7d;
root /var/www/html/domain;
valid_referers none blocked test.com *.test.com *.
facebook.com *.twitter.com;
if ($invalid_referer) {
return 403;
}
}

Regards.
Shahzaib

Hello!

On Thu, Nov 28, 2013 at 01:16:23PM +0500, shahzaib shahzaib wrote:

Hello,

   The root directory path is /var/www/html/domain and every file

within it is hotlink protected for (mp4). Now here’s a file named
/var/www/html/domain/videos/test.mp4 and i want this file to be available
for public with no hotlinking restriction. Is that possible with nginx ?
vhost config is given below. Please help me regarding it.

Adding an exact match location will help, e.g.:

 location = /test.mp4 {
     # no hotlink protection here
     ...
 }

See http://nginx.org/r/location for details on location matching.


Maxim D.
http://nginx.org/en/donation.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs