Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: защита ссылок
- To: nginx-ru@xxxxxxxxx
- Subject: Re: защита ссылок
- From: "Ar3s" <nginx-forum@xxxxxxxx>
- Date: Tue, 09 Oct 2012 14:27:48 -0400
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tigger.jlkhosting.com; s=x; h=Date:Sender:From:References:In-Reply-To:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=8ItnxQEV/PBxJh1jJ/YyLG9SQp8abMTYXtEq5rx5ENs=; b=vIEIQRpexC/tYtAcoCnH+ewzdPljI96GUcXsNRLSiSfKf+5jqf/EOmlCVjUs1BXn3mKt/Ugo/WCwXFQp9iicurpy1vW4QcW3A3y4Mm58x6H3ERhXDPKlht1jprlqSnbM;
- In-reply-to: <50741091.1060104@kpi.ua>
- References: <50741091.1060104@kpi.ua>
nginx
server {
listen 80;
server_name site.ru;
access_log /dev/null;
location / {
root /var/www/work;
index index.html index.htm index.php;
# rewrite ^/video/(w+)/(.+)$
/get.php?hash=$1&filename=$2last;
rewrite ^/video/(\w+)/(.+)$ /get.php?hash=$1&filename=$2
last;
}
# location /video {
location ~ ^/video/.*\.flv$ {
root /var/www/work;
internal;
flv;
}
location ~ \.php$ {
fastcgi_pass unix:/tmp/.fastcgi.www-data/socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/var/www/work/$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
include fastcgi_params;
proxy_send_timeout 360;
proxy_read_timeout 360;
}
-------------------------------------------------------------------------------------------------------
get.php
<?php
$hash =$_GET['hash'];
$filename = $_GET['filename'];
$ip = md5($_SERVER['REMOTE_ADDR'].'key');
if ($hash == $ip){
$url=$_SERVER['REQUEST_URI'];
$url=explode('?',$url);
$url=$url[1];
if (isset($url)){$filename .='?'.$url;}
header('Content-Type: video/x-flv');
header('X-Accel-Redirect:/video/'.$filename);
die();
}
echo 'NO';
?>
--------------------------------------------------------------------------------------------
нарыл уже в сети кучу примеров. Но не работает хоть тресни. Подозреваю что
дело либо в php скрипте либо в моих настройках либо в моих руках...
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,231504,231550#msg-231550
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
|