Nginx ngx_http_vod_module Kaltura module remote config

Hi guys,
i’m n00b in nginx.conf and i must config my nginx server to serve playlist.m3u8 file from an external .mp4 file.

My server is configured with nginx 1.14.0 (Ubuntu based) and ngx_http_vod_module.so module (only this, no full Kaltura installed, i must use only this module, loaded in nginx.conf file)

The .mp4 file is placed in a reachable server (hostname/mp4folder/mp4file.mp4, i can download this file without any problem but i must take the playlist.m3u8 “on fly” by “hostname/mp4folder/mp4file.mp4/playlist.m3u8” link)

So… how can i config my nginx.conf or my nginx site conf to convert and serve in HLS flavour my mp4file.mp4? I know that i must call it in this way (by browser or Fiddler): hostname/mp4folder/mp4file.mp4/playlist.m3u8

I read https://github.com/kaltura/nginx-vod-module very well but all my tries were fail.

NB: my mp4 uri (hostname/mp4folder/mp4file.mp4) is stored in a var called ngx.var.mediauri, computated by LUA. At the end LUA call ngx.exec("@remoteHls") location, put in my custom site file. It reaches this location with ngx.var.mediauri correctly set but i don’t know how to do ahah every try gives me 404!!!

Thanks :smiley:

Hello @Stiff91x,

Please post your Nginx config as well as the results returned when making the request as well as any errors you see in the log file.

Cheers,

Hello Jess :smiley:

this is my NGINX config:
# vod settings
vod_mode remote;
vod_upstream_location @remoteHls;
vod_last_modified ‘Sun, 19 Nov 2000 08:52:00 GMT’;
vod_last_modified_types *;

            # vod caches
            vod_metadata_cache metadata_cache 512m;
            vod_response_cache response_cache 128m;

            # gzip manifests
            gzip on;
            gzip_types application/vnd.apple.mpegurl;

location /content/ {
“lua code that correctly go to @remoteHls with ngx.var.mediauri correctly set”
}

            location @remoteHls {
			vod hls;
			
			add_header Access-Control-Allow-Headers '*';
			add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
			add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
			add_header Access-Control-Allow-Origin '*';
			expires 100d;

proxy_pass http://$mediauri (hostname/folder/vod.mp4);
}

and my call is: {IPADDRESS}/content/vod.mp4/playlist.m3u8

I think my problem is only to correctly set vod_upstream_location, i think i misunderstanding how to use it

Please review https://github.com/kaltura/nginx-vod-module#sample-configurations-1

Ok, this is my cleaned nginx config:

upstream kalapi {
                server www.pr0t3ck.altervista.org:80;
        }

server {
        listen 80;
        listen [::]:80;
        resolver 8.8.8.8;

# vod settings
                vod_mode remote;
                vod_upstream_location /kalapi;
                vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
                vod_last_modified_types *;

                # vod caches
                vod_metadata_cache metadata_cache 512m;
                vod_response_cache response_cache 128m;

                # gzip manifests
                gzip on;
                gzip_types application/vnd.apple.mpegurl;

                location /kalapi/ {
                        internal;
                        proxy_pass http://kalapi/;
                        proxy_set_header Host $http_host;
                }

                location ~ ^/p/\d+/(sp/\d+/)?serveFlavor/ {
                        vod hls;

                        add_header Access-Control-Allow-Headers '*';
                        add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
                        add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
                        add_header Access-Control-Allow-Origin '*';
                        expires 100d;
                }
}

and this is the call: http://{NGINX_SERVER_IP}/kalapi/content/vod.mp4/playlist.m3u8

and the file is stored in: pr0t3ck.altervista.org/content/vod.mp4

Or maybe do you have other example? on Google i only find local example, nothing in remote :frowning:

Hi @Stiff91x,

Since you said you are not using the Kaltura server at all, I’m not sure why you have kalapi blocks in your config.

If you install the kaltura-nginx deb package, it lets you choose which mode you wish to operate in and it will do the config for you, based on your inputs. If you work with a distro the deb package cannot be installed on, you may use the config here as reference:


Replace the @.*@ tokens with the values that reflect your setup and make sure that include @NGINX_CONF_PATH@/server.conf points to a modified version of https://github.com/kaltura/nginx-vod-module/blob/master/conf/vod-remote.conf.template

1 Like