I want to use streaming video with nginx for a windows server. I have this nginx configuration:
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
proxy_max_temp_file_size 0;
proxy_cache_path /nginx/cache levels=1:2 keys_zone=STATIC:1000m max_size=1000m inactive=720m;
proxy_temp_path /nginx/tmp;
server {
listen 81;
server_name 127.0.0.1;
location ~* .(jpe?g|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ {
access_log off;
proxy_pass http://10.1.4.22:9001;
proxy_cache STATIC;
proxy_ignore_headers "Set-Cookie";
proxy_hide_header "Set-Cookie";
}
location / {
proxy_pass http://10.1.4.22:9001;
}
location ~* /!/scorms.ecp/\d+(/.*\.(mp4|webm|ogv))$ {
root /video;
proxy_pass http://10.1.4.22:9001;
rewrite /!/scorms.ecp/\d+/(\w+)/\d+/\d+/\w+/(.+) /$1/$2 break;
try_files $1 @fallback;
error_log logs/error.log debug;
flv;
mp4;
mp4_buffer_size 512k;
mp4_max_buffer_size 1m;
}
location @fallback {
proxy_pass http://10.1.4.22:9001;
flv;
mp4;
mp4_buffer_size 512k;
mp4_max_buffer_size 1m;
}
}
}
The most important thing in this configuration:
location ~* /!/scorms.ecp/\d+(/.*\.(mp4|webm|ogv))$ {
root /video;
proxy_pass http://10.1.4.22:9001;
rewrite /!/scorms.ecp/\d+/(\w+)/\d+/\d+/\w+/(.+) /$1/$2 break;
try_files $1 @fallback;
error_log logs/error.log debug;
flv;
mp4;
mp4_buffer_size 512k;
mp4_max_buffer_size 1m;
}
I am sending a request http: // host: port /! /Scorms.ecp/27/TESTC/1/1/images/pravilo2.mp4 . In error.log, I have:
2016/05/25 09:53:19 [error] 9200#7996: *1 CreateFile() "D:\PAPISDK_4_T\nginx-1.10.0/html/TESTC/pravilo11.mp4" failed (3: The system cannot find the path specified), client: 10.1.4.22, server: 127.0.0.1, request: "GET /!/scorms.ecp/27/TESTC/1/1/images/pravilo11.mp4 HTTP/1.1", host: "10.1.4.22:81", referrer: "http://10.1.4.22:81/!/scorms.ecp/27/TESTC/1/1/start.html"
I do not understand why nginx is trying to find "D: \ PAPISDK_4_T \ nginx-1.10.0 / html / TESTC / pravilo11.mp4" instead of "D: \ video / TESTC / pravilo11.mp4". I tried using "root D: \ video;" and got the same error. I also tried using an "alias" instead of "root", but I got the following error:
alias /video; -> "alias" cannot be used in location "/!/scorms.ecp/\d+(/.*\.(mp4|webm|ogv))$" where URI was rewritten
nginx Windows, "D:\video/TESTC/pravilo11.mp4" "D:\PAPISDK_4_T\nginx-1.10.0/html/TESTC/pravilo11.mp4"?