Hi,<br><br>Do you use this module to stream? <a href="http://h264.code-shop.com/trac">http://h264.code-shop.com/trac</a><br><br>This might not useful for you, but just for references.<br><br>I use this to stream mp4 movies (h264 video code) with lighttpd(they have a module for ngnix and apache), it's working great and without any problem.<br>
<br>Max<br><br><div class="gmail_quote">On Thu, Feb 19, 2009 at 7:15 AM, Karolis D <span dir="ltr"><<a href="mailto:karolis@pg.lt">karolis@pg.lt</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c"><div class="gmail_quote">On Wed, Feb 18, 2009 at 7:39 PM, Karolis <span dir="ltr"><<a href="mailto:karolis@pg.lt" target="_blank">karolis@pg.lt</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
hi list,<br>
<br>
I am using nginx / apache combination to stream flv files.<br>
Nginx serves static files and forwards dynamic requests to apache/mod_php.<br>
<br>
Request flow would be as follows:<br>
<br>
- client requests some file<br>
- nginx rewrites the filename to a local cache dir<br>
- if file is found in the cache dir, nginx sends the file<br>
- if file is not found, then request is passed to apache, which will create the file and send the contents.<br>
<br>
For flv files we want flv streaming.<br>
<br>
The rules I am using to make this work are as follows:<br>
<br>
# Map request url to cache dir<br>
location /dbfile {<br>
rewrite "^/dbfile/([0-9]{3})([0-9]{3})([0-9]{3})/(.*)$" /cache/$1/$2/$1$2$3__$4 last;<br>
}<br>
<br>
# Forward PHP requests to apache, in case we don't have cache yet<br>
location ~ ^/cache/ {<br>
if (!-f $request_filename) {<br>
proxy_pass <a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>;<br>
break;<br>
}<br>
}<br>
<br>
# Handle FLV streaming<br>
location ~ ^/cache/(.*)\.flv$ { flv; }<br>
<br>
In this configuration, proxy_pass works, but flv streaming doesn't.<br>
If I move FLV "location" directive above proxy_pass, then flv will work, and proxy_pass won't.<br>
<br>
How do I get them both to work together? I don't want streaming of proxied requests, I only want to<br>
flv-stream the files that are on local filesystem.<br>
<br>
Any help?<br>
<br>
thanks<br><font color="#888888">
Karolis<br>
<br>
</font></blockquote></div><br></div></div>I've also tried to work around the problem by rewriting flv file to php
script, and then proxy_pass'ing the php to apache, but the results are
no better:<div class="Ih2E3d"><br>
<br>
# Map request url to cache dir<br>
location ~ ^/dbfile/ {<br>
rewrite "^/dbfile/([0-9]{3})([0-9]{3})([0-9]{3})/(.*)$" /cache/$1/$2/$1$2$3__$4 last;<br>
}<br>
<br></div>
# If required cache file does not exist...<div class="Ih2E3d"><br>
location ~ ^/cache/ {<br>
if (!-f $request_filename) {<br></div>
rewrite "/cache/([0-9]{3})/([0-9]{3})/([0-9]{9})__(.*)$" /file.php?id=$3 last;<br>
}<br>
}<br>
<br>
location ~ ^/cache/(.*)\.flv$ { flv; }<br>
<br>
# Forward PHP requests to Apache<br>
location ~ ^/file.php {<br>
proxy_pass <a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>; # pass on request to apache<br>
}<br><br>If I comment out the proxy_pass section, then the FLV streaming starts to work fine. So it kind of means nginx doesn't like the proxy part of the setup.<br><br>I do understand that you can't stream a file that is retrieved from a proxy server, but in this setup I am trying to do only one of those things: Either fetch the file from proxy if it doesn't exist locally, or flv-stream it if it does exist.<br>
<br>Problem is that lighttpd does it without a problem with mod_magnet :)<br><font color="#888888"><br>Karolis<br>
</font></blockquote></div><br>