上一篇讲了如何在Linux系统上安装Nginx:安装Nginx + nginx-http-flv-module。本篇记录一下如何用Nginx + nginx-http-flv-module实现直播和点播功能。
要实现直播和点播,首先需要正确配置Nginx,进入Nginx配置文件路径:/usr/local/nginx/conf (如果安装自定义路径的话,请进入自己的实际安装路径),可以看到有以下这些文件:
我们需要编辑的是nginx.conf。
1. nginx.conf的配置
我目前支持http-flv直播、http-hls直播以及点播功能,所以我的最终配置如下:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
rtmp {
out_queue 4096;
out_cork 8;
max_streams 128;
timeout 15s;
drop_idle_publisher 15s;
log_interval 5s; #interval used by log module to log in access.log, it is ver