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&#39;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">&lt;<a href="mailto:karolis@pg.lt">karolis@pg.lt</a>&gt;</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">&lt;<a href="mailto:karolis@pg.lt" target="_blank">karolis@pg.lt</a>&gt;</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>
 &nbsp; # Map request url to cache dir<br>
 &nbsp; location /dbfile {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rewrite &nbsp;&quot;^/dbfile/([0-9]{3})([0-9]{3})([0-9]{3})/(.*)$&quot; /cache/$1/$2/$1$2$3__$4 &nbsp;last;<br>
 &nbsp; }<br>
<br>
 &nbsp; # Forward PHP requests to apache, in case we don&#39;t have cache yet<br>
 &nbsp; location ~ ^/cache/ {<br>
 &nbsp; &nbsp; &nbsp; if (!-f $request_filename) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_pass &nbsp;<a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>;<br>
 &nbsp; &nbsp; &nbsp; break;<br>
 &nbsp; &nbsp; &nbsp; }<br>
 &nbsp; }<br>
<br>
 &nbsp; # Handle FLV streaming<br>
 &nbsp; location ~ ^/cache/(.*)\.flv$ { flv; }<br>
<br>
In this configuration, proxy_pass works, but flv streaming doesn&#39;t.<br>
If I move FLV &quot;location&quot; directive above proxy_pass, then flv will work, and proxy_pass won&#39;t.<br>
<br>
How do I get them both to work together? I don&#39;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&#39;ve also tried to work around the problem by rewriting flv file to php
script, and then proxy_pass&#39;ing the php to apache, but the results are
no better:<div class="Ih2E3d"><br>
<br>
&nbsp;&nbsp;&nbsp; # Map request url to cache dir<br>
&nbsp;&nbsp;&nbsp; location ~ ^/dbfile/ {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewrite&nbsp; &quot;^/dbfile/([0-9]{3})([0-9]{3})([0-9]{3})/(.*)$&quot; /cache/$1/$2/$1$2$3__$4&nbsp; last;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If required cache file does not exist...<div class="Ih2E3d"><br>
&nbsp;&nbsp;&nbsp; location ~ ^/cache/ {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!-f $request_filename) {<br></div>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rewrite &quot;/cache/([0-9]{3})/([0-9]{3})/([0-9]{9})__(.*)$&quot; /file.php?id=$3 last;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location ~ ^/cache/(.*)\.flv$ { flv; }<br>
<br>
&nbsp;&nbsp;&nbsp; # Forward PHP requests to Apache<br>
&nbsp;&nbsp;&nbsp; location ~ ^/file.php {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; proxy_pass&nbsp; <a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>; # pass on request to apache<br>
&nbsp;&nbsp;&nbsp; }<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&#39;t like the proxy part of the setup.<br><br>I do understand that you can&#39;t stream a file that is retrieved from a proxy server, but in this setup&nbsp; I am trying to do only one of those things: Either fetch the file from proxy if it doesn&#39;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>