hi,
i’ve successfully reverse proxying streaming content through nginx.
this is my config
location /stream/ {
proxy_pass http://xxx.xxx.xxx.xxx:8080/stream.flv;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
open via browser http://www.example.com/stream/ success,without
problem.
however, i need to append fake uri such as
http://www.example.com/stream/stream/content.flv
here’s what i’ve done so far
location /stream/content.flv {
proxy_pass http://xxx.xxx.xxx.xxx:8080/stream.flv;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}
it’s always pointed to /var/www/html/stream/content.flv
[error] 24546#0: *1 open() “/var/www/html/stream/content.flv” failed (2:
No such file or directory)
any clues?
thanks
Powered By http://www.3g-net.net
On Wed, Apr 13, 2011 at 05:38:25PM +0700, Hari Hendaryanto wrote:
Hi there,
i’ve successfully reverse proxying streaming content through nginx.
location /stream/ {
proxy_pass http://xxx.xxx.xxx.xxx:8080/stream.flv;
open via browser http://www.example.com/stream/ success,without problem.
So: the browser asks nginx for /stream/, nginx asks the backend for
/stream.flv, and things work happily.
however, i need to append fake uri such as
http://www.example.com/stream/stream/content.flv
The browser asks nginx for /stream/stream/content.flv. With
the above configuration, nginx asks the backend for
/stream.flvstream/content.flv. That doesn’t work for you.
So: what url do you want nginx to ask the backend for?
here’s what i’ve done so far
location /stream/content.flv {
This location doesn’t match your request, so won’t be used.
any clues?
The debug log will show which location{} block is used for this request.
But before that: decide what you want nginx to ask the backend for,
and see if Module ngx_http_proxy_module shows you
how to achieve that.
Good luck with it,
f
Francis D. [email protected]
Hello!
On Wed, Apr 13, 2011 at 05:38:25PM +0700, Hari Hendaryanto wrote:
proxy_set_header Host $host;
[error] 24546#0: *1 open() “/var/www/html/stream/content.flv” failed
(2: No such file or directory)
any clues?
Most likely you have some regexp location in your config which
matches *.flv.
If you need exact match - most obvious solution is to use exact
match location instead, i.e.
location = /stream/content.flv {
...
}
Exact match locations are considered most specific and prevent
testing of regexp locations. The same for normal static locations
may be achieved via “^~” (no regexp) modifier.
Alternative aproach is to properly isolate regexp locations by
nesting them into appropriate normal locations, i.e. do something
like
location / {
...
location ~ \.flv$ {
...
}
}
location /stream/ {
...
}
This is actually recommended, but not exactly required in your
case as it looks like you need exact match anyway.
Maxim D.
hi, francis, thanks for quick reply
On 4/13/2011 6:30 PM, Francis D. wrote:
however, i need to append fake uri such as
http://www.example.com/stream/stream/content.flv
The browser asks nginx for /stream/stream/content.flv. With
the above configuration, nginx asks the backend for
/stream.flvstream/content.flv. That doesn’t work for you.
So: what url do you want nginx to ask the backend for?
ok, sorry that was typo. it should be
http://www.example.com/stream/content.flv
here’s what i’ve done so far
location /stream/content.flv {
This location doesn’t match your request, so won’t be used.
any clues?
The debug log will show which location{} block is used for this request.
But before that: decide what you want nginx to ask the backend for,
and see if Module ngx_http_proxy_module shows you
how to achieve that.
but i don’t want to pass anything to backend, just creating dummy uri
“/stream/content.flv” , so my browser embbeded flash player recognize
it.
but thanks anyway
Good luck with it,
f
Powered By http://www.3g-net.net
On 4/13/2011 6:43 PM, Maxim D. wrote:
whoaa, you’re so great. it worked.
thanks alot maxim
case as it looks like you need exact match anyway.
Maxim D.
nginx mailing list
[email protected]
nginx Info Page
Powered By http://www.3g-net.net