можно ли сделать на подобе сайта 2spb.ru за ~150$?? (без дизайна)
(закасчик мне заказывал давно, но не было времени сделать)
в логах nginx такая строка:
2010/11/25 05:59:43 [error] 19835#0: *1 could not find named location "http://www.x0.org.ua/to_nginx?bs=$body_bytes_sent" while sending response to cl$ 2010/11/25 06:27:33 [error] 19835#0: *2 could not find named location "http://www.x0.org.ua/to_nginx?bs=$body_bytes_sent" while sending response to cl$
он не может отправить запрос на другой сервер (доменое имя) ?
rtyug добавил 25.11.2010 в 17:36
видимо, нет
/nginx -V nginx version: nginx/0.8.48 built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42) configure arguments: --with-http_perl_module --with-http_stub_status_module
для того чтобы он отправил запрос надо собрать с uplaod?
rtyug добавил 25.11.2010 в 19:59
вродебы разобрался
# Premium location /download_p/ { alias /home/files/cgi-bin/uploads/; internal; #set $limit_rate 500k; limit_conn one 50; set $postURI $uri; set $postIP $remote_addr; set $postHOST $host; post_action @postDownload; } location @postDownload { proxy_pass http://193.201.81.40/to_nginx?bs=$body_bytes_sent&domain=$postHOST&uri=$postURI; proxy_set_header X-Real-IP $postIP; proxy_set_header BytesSent $body_bytes_sent; }
запрос не хочет отправятся...
я добавил строку
post_action http://www.site.com/to_nginx?bs=$body_bytes_sent;
в полностью рабочий конфиг
# Free location /download_f/ { alias /home/file/cgi-bin/uploads/; internal; set $limit_rate 40k; limit_conn one 1; post_action http://www.site.com/to_nginx?bs=$body_bytes_sent; } # Registered location /download_r/ { alias /home/files/cgi-bin/uploads/; internal; set $limit_rate 40k; limit_conn one 1; post_action http://www.site.com/to_nginx?bs=$body_bytes_sent; } # Premium location /download_p/ { alias /home/file/cgi-bin/uploads/; internal; #set $limit_rate 500k; limit_conn one 50; post_action http://www.site.com/to_nginx?bs=$body_bytes_sent; }
но запрос НЕ отправился после того как я скачал файл, в логах apache на http://www.site.com/ в error и access нету запроса
Товарищи, подскажите есть:
post_action
location ~* ^/media/.+\.(mp3|wma|ogg|ape|flac)$ { post_action /counter.php?bs=$body_bytes_sent; }
кроме $body_bytes_sent, как отправить после того как клиент скачет что-то одно из:
1) хеш который был прислан для разрешения скачивания файла (чтобы идентифицировать скачивание и файл пользователя)
2) или имя отдаваемого файла, но лучше п.1
где это найти?
Detektiv, можно сделать, я участвовал в разработке и поддержке одной из крупнейшей банерской сети в западном сементе, можно сделать на основе этой...
там еще есть perl модуль perl_require download.pm;
package download; use strict; use nginx; use Crypt::HCE_MD5; my $dl_key = "re2lgr5"; my $upload_dir="/home/file/cgi-bin/uploads"; sub handler { my $r = shift; my $hce = Crypt::HCE_MD5->new($dl_key,"XFile"); ($_) = $r->filename=~/\/(\w+)\/[^\/]+$/; my $l; tr|a-z2-7|\0-\37|; $_=unpack('B*',$_); s/000(.....)/$1/g; $l=length; $_=substr($_,0,$l & ~7) if $l & 7; $_=pack('B*',$_); my ($srv_id,$file_id,$usr_id,$dx,$id,$dmode,$i1,$i2,$i3,$i4,$expire) = unpack("SLLSA12AC4L", $hce->hce_block_decrypt($_) ); $dx=sprintf("%05d",$dx); if($r->remote_addr !~ /^$i1\.$i2\./) { $r->internal_redirect("/error_wrong_ip.html"); } elsif($expire<time) { $r->internal_redirect("/error_expired.html"); } elsif(!-f "$upload_dir/$dx/$id") { $r->internal_redirect("/error_nofile.html"); } else { $r->header_out("Content-Disposition","attachment"); $r->internal_redirect("/download_$dmode/$dx/$id?id=$file_id&usr=$usr_id".$r->args); } return OK; } 1;
вродебы это оно:
#user nobody; worker_processes 8; worker_rlimit_nofile 10240; worker_rlimit_sigpending 32768; error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 2048; } http { include mime.types; default_type application/octet-stream; access_log logs/access.log combined; access_log logs/access.log combined; #sendfile on; #tcp_nopush on; reset_timedout_connection on; server_tokens off; autoindex off; keepalive_timeout 0; #keepalive_timeout 65; limit_zone one $binary_remote_addr 10m; perl_modules perl; perl_require download.pm; server { listen 182; server_name localhost; proxy_set_header X-Real-IP $remote_addr; #charset koi8-r; location /nstatus { stub_status on; #allow 127.0.0.1; #deny all; } location / { root html; index index.html index.htm; } location /d/ { perl download::handler; } # Free location /download_f/ { alias /home/file/cgi-bin/uploads/; internal; set $limit_rate 40k; limit_conn one 1; } # Registered location /download_r/ { alias /home/files/cgi-bin/uploads/; internal; set $limit_rate 40k; limit_conn one 1; } # Premium location /download_p/ { alias /home/file/cgi-bin/uploads/; internal; #set $limit_rate 500k; limit_conn one 50; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
/ru/forum/570046
Brut
изучи нормально PERL, все остальное - это так... игрушки )
Слава Шевцов
Программист - это человекообразный интерфейс между хотелками бизнесменов и возможностями компьютеров.
наш человек :)
не могу найти ни где, где этот хэш (хэш число) который идет в url во внутреннем редиректе?
т.е. мне нужно передать число байт и хэш в скрипт
fastcgi - мне не нужен