Serving embedded video files with X-Accel-Redirect to IE 6 browser

Thomas iamkenzo at gmail.com
Wed Apr 16 19:55:00 MSD 2008


Actually there is nothing fancy in Nginx conf files, simply declare
the folder that holds the protected content as "internal" so users
can't directly access it:

location /files {
     root /var/www/myapp/files;
     internal;
}


The real magic happens in your app:

<?php
$path = $_GET["path"];
header("Content-Type: video/quicktime");
header("X-Accel-Redirect: /files/" . $path);
?>

Of course you need to add your own protection scheme (like
anti-leeching or paid membership), now you can access the video
content by using the url:
http://mysite.com/downloads.php?path=video.mov





More information about the nginx mailing list