I tried whole day to make an nginx vhost config to acomplish my needs but i make it wrong all the time. Here is what i need to do.
I have a server in which i stream Movies & Live Streams. The Movies & Streams are being restreamed from a .php file . Everything is fine with this. These 2 files are stream_live.php and stream_movies.php
I want to use different fastcgi_ settings depending on the type value i will select. For example for livestreams you can select to be in mpegts or hls. I want this as a parameter in PHP File. Now i will give examples in order to understand it better.
I want each time a user requests like this:
http://domain.com/live/username/password/1.live?type=hls
to be redirected in the file stream_live.php with parameteres username,password,id and type (1 = id here). How i can do that?
And for the movies i want a similar one like
http://domain.com/movies/username/password/1.movie
to be redirected in the file stream_movies with parameterers Username/Password/ID (1 = ID)
One small note! As i said above i want to use different settings if you are requesting movies or live streams.
So for movies i want to use
- fastcgi_buffering off;
For Live Streams i want to use
- fastcgi_buffering on; EXCEPT in type=hls which i want it fastcgi_buffering off;
Sorry that i'm requesting the whole nginx config but i tried whole day to make it and i couldn't. :(
Thank you
So basically you want to control just the
fastcgi_buffering
setting based on the type parameter? Read the fine manual and notice this part:So, to simplify this, use a simple nginx configuration for routing:
... and in PHP you should send the
X-Accel-Buffering: no
header field to disable buffering. For plain PHP you could use something like:Remember that the default value for
fastcgi_buffering
ison
. Adjust the logic above to your needs.