BLSS is a NGINX third-party module, which is based on the secondary development of open source projects nginx-rtmp-module to achieve, based on the original features to retain some of the key features, Such as HTTP-FLV protocol distribution, GOP cache, regular match push-pull domain name, virtual host and so on.
Download nginx:
wget https://nginx.org/download/nginx-$VERSION.tar.gz
tar zxvf nginx-$VERSION.tar.gz
Download BLSS:
wget https://github.com/gnolizuh/BLSS/archive/v1.1.4.tar.gz
tar zxvf v1.1.4.tar.gz
Compile and install:
cd NGINX-SRC-DIR
./configure --add-module=/path/to/BLSS
make
make install
Compile with debug mode:
./configure --add-module=/path/to/BLSS --with-debug
A nginx.conf example:
worker_processes 8; # multi-worker process mode
relay_stream hash; # stream relay mode
# rtmp block
rtmp {
server {
listen 1935 reuseport;
service cctv {
hostname pub rtmp *.pub.rtmp.cctv; # match rtmp push domain
hostname sub rtmp *.sub.rtmp.cctv; # match rtmp pull domain
hostname sub http_flv *.sub.httpflv.cctv; # match http-flv pull domain
application news {
live on;
http_flv on;
gop_cache on;
gop_cache_count 5; # cache 5 GOPs
hls on;
hls_fragment 10s;
hls_playlist_length 30s;
}
application sports {
hls on;
hls_fragment 1m;
hls_playlist_length 3m;
}
}
}
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/http_sla.log main;
keepalive_timeout 60;
server {
listen 80 reuseport;
location / {
http_flv on; # delivery http-flv
}
}
}
run nginx:
./obj/nginx -p /path/to/nginx