Answer the question
In order to leave comments, you need to log in
How to whitelist referrers in nginx?
It is required to restrict access to video - allow access from only a few sites. It seems to be the valid_referers directive, but something doesn't work for me. Here is the config code, simplified:
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
upload_progress proxied 1m;
server_names_hash_bucket_size 128;
proxy_buffering off;
server {
server_name example.com www.example.com;
listen 11.22.33.44;
charset CP1251;
index index.php;
set $root_path /var/www/lalafa/data/www/example.com;
location / {
proxy_pass http://11.22.33.44:81;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 500m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
charset off;
track_uploads proxied 30s;
}
location ~* ^.+\.(mp4)$ {
mp4;
root $root_path;
}
location ~* ^.+\.(flv)$ {
flv;
root $root_path;
}
location ~* ^/uploads/video/(site1|site3)/{
mp4;
root $root_path;
limit_rate 150k;
}
location ~* ^/uploads/(video|man)/{
mp4;
root $root_path;
limit_rate 100k;
valid_referers none blocked www.example.com example.com;
}
location ~* ^/uploads/(video|man)/{
flv;
root $root_path;
limit_rate 100k;
}
}
}
Answer the question
In order to leave comments, you need to log in
and yet - why the first parameter in location mp4 inside - repeats "mp4;"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question